33on :
44 pull_request :
55 types :
6- - closed
6+ - opened
7+ - synchronize
8+ - reopened
79 push :
810 branches :
911 - main
1214jobs :
1315 prepare :
1416 runs-on : ubuntu-latest
15- if : github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true
1617
1718 outputs :
1819 submodule-matrix : ${{ steps.discover-submodules.outputs.submodule-matrix }}
1920 steps :
2021 - name : Checkout repository
21- uses : actions/checkout@v2
22+ uses : actions/checkout@v4
2223 with :
2324 submodules : recursive
2425 persist-credentials : true
4243 echo "submodule-matrix=$(cat submodules.json)" >> $GITHUB_OUTPUT
4344
4445 - name : Commit Metadata
46+ if : github.event_name != 'pull_request' && github.event.repository.fork == false
4547 run : |
4648 git config --global user.name 'github-actions[bot]'
4749 git config --global user.email 'github-actions[bot]@users.noreply.github.com'
@@ -62,13 +64,14 @@ jobs:
6264 runs-on : ubuntu-latest
6365 strategy :
6466 fail-fast : false
65- matrix :
66- repository : ${{ fromJson(needs.prepare.outputs.submodule-matrix) }}
67+ matrix : ${{ fromJson(needs.prepare.outputs.submodule-matrix) }}
68+ name : Build ( ${{ matrix.submodules.repository }})
6769 steps :
6870 - name : Checkout Repository
6971 uses : actions/checkout@v4
7072 with :
71- repository : ${{ matrix.repository }}
73+ repository : ${{ matrix.submodules.repository }}
74+ ref : ${{ matrix.submodules.sha }}
7275 token : ${{ secrets.GITHUB_TOKEN }}
7376 fetch-depth : 0
7477 submodules : recursive
7881 with :
7982 node-version : ' 20'
8083
84+ - name : Run Database code
85+ if : github.event_name != 'pull_request' && github.event.repository.fork == false
86+ env :
87+ UPLOAD_TO_DATABASE : true
88+ run :
89+ echo "Running database code"
90+
8191 - name : Install Database SDK
92+ if : env.UPLOAD_TO_DATABASE
8293 run : |
8394 sudo apt-get update
8495 sudo apt-get install apt-transport-https ca-certificates gnupg curl
8798 sudo apt-get update && sudo apt-get install google-cloud-cli
8899
89100 - name : Authenticate to Database
101+ if : env.UPLOAD_TO_DATABASE
90102 env :
91103 GCP_SERVICE_ACCOUNT_KEY : ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
92104 run : |
@@ -111,6 +123,8 @@ jobs:
111123
112124 - name : Prepare Distribution Files
113125 id : prepare-distribution
126+ env :
127+ UPLOAD_TO_DATABASE : ${{ env.UPLOAD_TO_DATABASE }}
114128 run : |
115129
116130 mkdir -p dist
@@ -146,7 +160,7 @@ jobs:
146160 id=$(jq -r '.id' dist/metadata.json)
147161
148162 # Get repository name from the matrix
149- REPOSITORY_NAME=$(echo ${{ matrix.repository }} | cut -d'/' -f2)
163+ REPOSITORY_NAME=$(echo ${{ matrix.submodules. repository }} | cut -d'/' -f2)
150164 echo "id=$REPOSITORY_NAME" >> $GITHUB_OUTPUT
151165
152166 cd dist
@@ -155,9 +169,11 @@ jobs:
155169
156170 echo "::debug::Successfully built plugin."
157171
158- echo "::debug::Uploading plugin to database..."
159- gsutil cp "$REPOSITORY_NAME.zip" gs://millennium-d9ce0.appspot.com/plugins/"$id.zip"
160- echo "::debug::Successfully uploaded plugin to database."
172+ if [ "${UPLOAD_TO_DATABASE}" = "true" ]; then
173+ echo "::debug::Uploading plugin to database..."
174+ gsutil cp "$REPOSITORY_NAME.zip" gs://millennium-d9ce0.appspot.com/plugins/"$id.zip"
175+ echo "::debug::Successfully uploaded plugin to database."
176+ fi
161177
162178 - name : Upload Plugin Artifact
163179 uses : actions/upload-artifact@v4
0 commit comments