Update build-and-deploy-plugins.yml

This commit is contained in:
BushraS-Protean
2025-05-20 15:31:37 +05:30
committed by GitHub
parent ad9540c261
commit 98b0fc3e77

View File

@@ -28,45 +28,19 @@ jobs:
# Example Gerrit clone # Example Gerrit clone
git clone https://open-networks.googlesource.com/onix-dev gerrit-repo git clone https://open-networks.googlesource.com/onix-dev gerrit-repo
- name: Build Go plugins in Docker - name: List directory structure
run: | run: |
set -e echo "📂 Contents of root:"
mkdir -p $PLUGIN_OUTPUT_DIR ls -alh
BUILD_CMDS=""
# GitHub plugins echo "📂 Contents of GitHub repo:"
for dir in pkg/plugin/implementation/*; do ls -alh github-repo
plugin=$(basename "$dir")
BUILD_CMDS+="go build -buildmode=plugin -buildvcs=false -o ${PLUGIN_OUTPUT_DIR}/${plugin}.so ./${dir}/cmd && "
done
# Gerrit plugins echo "📂 Deep list of GitHub repo:"
for dir in onix-dev/plugins/*; do find github-repo
plugin=$(basename "$dir")
BUILD_CMDS+="go build -buildmode=plugin -buildvcs=false -o ${PLUGIN_OUTPUT_DIR}/${plugin}.so ./${dir}/cmd && "
done
BUILD_CMDS=${BUILD_CMDS%" && "} echo "📂 Contents of Gerrit repo:"
docker run --rm -v "$(pwd)":/app -w /app golang:1.24-bullseye sh -c "$BUILD_CMDS" ls -alh gerrit-repo
- name: Zip the plugin binaries echo "📂 Deep list of Gerrit repo:"
run: | find gerrit-repo
cd $PLUGIN_OUTPUT_DIR
zip -r ../$ZIP_FILE *.so
cd ..
- name: Authenticate to GCP
run: |
echo "${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }}" > gcloud-key.json
gcloud auth activate-service-account --key-file=gcloud-key.json
gcloud config set project trusty-relic-370809
env:
GOOGLE_APPLICATION_CREDENTIALS: gcloud-key.json
- name: Upload to GCS
run: |
gsutil -m cp -r $ZIP_FILE gs://${GCS_BUCKET}/
- name: Cleanup
run: |
rm -rf $PLUGIN_OUTPUT_DIR $ZIP_FILE gcloud-key.json