Skip to content

Commit a43c528

Browse files
committed
Skip publishing releases to AWS if credentials not configured
The "Release" and "Publish Nightly Build" workflows upload the generated build files to the AWS S3 bucket used by Arduino's downloads server. The necessary credentials are configured in Arduino's repository. However, these workflows might be used in other contexts: - by contributors validating proposed changes to the release infrastructure in their fork - by hard forks of the project In either case (especially the former), the fork owner is unlikely to be willing/able to set up the AWS infrastructure that would be needed to use this capability of the workflow. Since these workflows also publish the builds to GitHub, the AWS upload is not essential to either 3rd party use case. The workflow code is hereby configured to skip the AWS upload steps if the necessary credentials have not been configured in the repository. The existence of the `AWS_ROLE_TO_ASSUME` repository secret is used as the indicator of whether the credentials are configured. This will allow runs of the workflow in forks without the need to remove the AWS upload steps.
1 parent c130eaa commit a43c528

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.github/workflows/publish-go-nightly-task.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,21 +254,29 @@ jobs:
254254
id-token: write # This is required for requesting the JWT
255255

256256
steps:
257+
- name: Determine whether publishing to AWS is possible
258+
id: aws-determination
259+
run: |
260+
echo "::set-output name=publish::${{ secrets.AWS_ROLE_TO_ASSUME != '' }}"
261+
257262
- name: Download artifact
263+
if: steps.aws-determination.outputs.publish == 'true'
258264
uses: actions/download-artifact@v6
259265
with:
260266
pattern: ${{ env.ARTIFACT_PREFIX }}*
261267
merge-multiple: true
262268
path: ${{ env.DIST_DIR }}
263269

264270
- name: configure aws credentials
271+
if: steps.aws-determination.outputs.publish == 'true'
265272
uses: aws-actions/configure-aws-credentials@v5
266273
with:
267274
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
268275
role-session-name: "github_${{ env.PROJECT_NAME }}"
269276
aws-region: ${{ env.AWS_REGION }}
270277

271278
- name: Upload release files on Arduino downloads servers
279+
if: steps.aws-determination.outputs.publish == 'true'
272280
run: |
273281
aws s3 sync \
274282
${{ env.DIST_DIR }} \

.github/workflows/release-go-task.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,11 @@ jobs:
221221
id-token: write # This is required for requesting the JWT
222222

223223
steps:
224+
- name: Determine whether publishing to AWS is possible
225+
id: aws-determination
226+
run: |
227+
echo "::set-output name=publish::${{ secrets.AWS_ROLE_TO_ASSUME != '' }}"
228+
224229
- name: Download artifact
225230
uses: actions/download-artifact@v6
226231
with:
@@ -275,13 +280,15 @@ jobs:
275280
artifacts: ${{ env.DIST_DIR }}/*
276281

277282
- name: configure aws credentials
283+
if: steps.aws-determination.outputs.publish == 'true'
278284
uses: aws-actions/configure-aws-credentials@v5
279285
with:
280286
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
281287
role-session-name: "github_${{ env.PROJECT_NAME }}"
282288
aws-region: ${{ env.AWS_REGION }}
283289

284290
- name: Upload release files on Arduino downloads servers
291+
if: steps.aws-determination.outputs.publish == 'true'
285292
run: |
286293
aws s3 sync \
287294
${{ env.DIST_DIR }} \

0 commit comments

Comments
 (0)