88
99jobs :
1010 build-pecl :
11+ environment : release
1112 name : " Create PECL package"
1213 runs-on : " ubuntu-latest"
14+ permissions :
15+ id-token : write
1316
1417 steps :
18+ - name : " Create temporary app token"
19+ uses : actions/create-github-app-token@v1
20+ id : app-token
21+ with :
22+ app-id : ${{ vars.APP_ID }}
23+ private-key : ${{ secrets.APP_PRIVATE_KEY }}
24+
25+ - name : " Store GitHub token in environment"
26+ run : echo "GH_TOKEN=${{ steps.app-token.outputs.token }}" >> "$GITHUB_ENV"
27+ shell : bash
28+
1529 - name : " Checkout"
1630 uses : " actions/checkout@v4"
1731 with :
2034 ref : ${{ github.ref }}
2135 submodules : true
2236
37+ - name : " Set up drivers-github-tools"
38+ uses : mongodb-labs/drivers-github-tools/setup@v2
39+ with :
40+ aws_role_arn : ${{ secrets.AWS_ROLE_ARN }}
41+ aws_region_name : ${{ vars.AWS_REGION_NAME }}
42+ aws_secret_id : ${{ secrets.AWS_SECRET_ID }}
43+
2344 - name : " Build Driver"
2445 uses : ./.github/actions/linux/build
2546 with :
@@ -44,17 +65,18 @@ jobs:
4465 echo "PACKAGE_FILE=mongodb-${PACKAGE_VERSION}.tgz" >> "$GITHUB_ENV"
4566
4667 - name : " Create detached signature for PECL package"
47- uses : mongodb-labs/drivers-github-tools/garasign/ gpg-sign@v1
68+ uses : mongodb-labs/drivers-github-tools/gpg-sign@v2
4869 with :
4970 filenames : ${{ env.PACKAGE_FILE }}
50- garasign_username : ${{ secrets.GRS_CONFIG_USER1_USERNAME }}
51- garasign_password : ${{ secrets.GRS_CONFIG_USER1_PASSWORD }}
52- artifactory_username : ${{ secrets.ARTIFACTORY_USER }}
53- artifactory_password : ${{ secrets.ARTIFACTORY_PASSWORD }}
5471
5572 - name : " Install release archive to verify correctness"
5673 run : sudo pecl install ${{ env.PACKAGE_FILE }}
5774
75+ # Copy the signature file from the release asset directory to avoid directory issues in the ZIP file
76+ # This can be removed once we're no longer uploading build artifacts
77+ - name : " Copy signature file"
78+ run : cp ${RELEASE_ASSETS}/${{ env.PACKAGE_FILE }}.sig .
79+
5880 - name : " Upload artifacts"
5981 uses : actions/upload-artifact@v4
6082 with :
6789 - name : " Upload release artifacts"
6890 run : gh release upload ${{ github.ref_name }} ${{ env.PACKAGE_FILE }} ${{ env.PACKAGE_FILE }}.sig
6991 continue-on-error : true
70- env :
71- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7292
7393 build-windows :
7494 name : " Create Windows package"
@@ -117,11 +137,14 @@ jobs:
117137 php_mongodb.pdb
118138
119139 sign-and-publish-windows :
140+ environment : release
120141 name : " Sign and Publish Windows package"
121142 needs : [build-windows]
122143 # ubuntu-latest is required to use enableCrossOsArchive
123144 # See https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cross-os-cache
124145 runs-on : " ubuntu-latest"
146+ permissions :
147+ id-token : write
125148
126149 strategy :
127150 fail-fast : false
@@ -132,8 +155,26 @@ jobs:
132155 ts : [ ts, nts ]
133156
134157 steps :
158+ - name : " Create temporary app token"
159+ uses : actions/create-github-app-token@v1
160+ id : app-token
161+ with :
162+ app-id : ${{ vars.APP_ID }}
163+ private-key : ${{ secrets.APP_PRIVATE_KEY }}
164+
165+ - name : " Store GitHub token in environment"
166+ run : echo "GH_TOKEN=${{ steps.app-token.outputs.token }}" >> "$GITHUB_ENV"
167+ shell : bash
168+
135169 - uses : actions/checkout@v4
136170
171+ - name : " Set up drivers-github-tools"
172+ uses : mongodb-labs/drivers-github-tools/setup@v2
173+ with :
174+ aws_role_arn : ${{ secrets.AWS_ROLE_ARN }}
175+ aws_region_name : ${{ vars.AWS_REGION_NAME }}
176+ aws_secret_id : ${{ secrets.AWS_SECRET_ID }}
177+
137178 - name : Restore cached build artifacts
138179 id : cache-build-artifacts
139180 uses : actions/cache/restore@v4
@@ -146,13 +187,13 @@ jobs:
146187 php_mongodb.pdb
147188
148189 - name : " Create detached DLL signature"
149- uses : mongodb-labs/drivers-github-tools/garasign/ gpg-sign@v1
190+ uses : mongodb-labs/drivers-github-tools/gpg-sign@v2
150191 with :
151192 filenames : php_mongodb.dll
152- garasign_username : ${{ secrets.GRS_CONFIG_USER1_USERNAME }}
153- garasign_password : ${{ secrets.GRS_CONFIG_USER1_PASSWORD }}
154- artifactory_username : ${{ secrets.ARTIFACTORY_USER }}
155- artifactory_password : ${{ secrets.ARTIFACTORY_PASSWORD }}
193+
194+ # Copy the signature file from the release asset directory to avoid directory issues in the ZIP file
195+ - name : " Copy signature file "
196+ run : cp ${RELEASE_ASSETS}/php_mongodb.dll.sig .
156197
157198 - name : " Upload DLL and PDB files as build artifacts"
158199 uses : actions/upload-artifact@v4
@@ -175,5 +216,3 @@ jobs:
175216 zip ${ARCHIVE} php_mongodb.dll php_mongodb.dll.sig php_mongodb.pdb CREDITS CONTRIBUTING.md LICENSE README.md THIRD_PARTY_NOTICES
176217 gh release upload ${{ github.ref_name }} ${ARCHIVE}
177218 continue-on-error : true
178- env :
179- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments