Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 971bea8

Browse files
authored
Merge pull request #991 from per1234/conditional-aws-upload
Skip publishing releases to AWS if credentials not configured
2 parents 4532c38 + dfc288d commit 971bea8

File tree

2 files changed

+49
-7
lines changed

2 files changed

+49
-7
lines changed

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

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,36 +219,71 @@ jobs:
219219
overwrite: true
220220
path: ${{ env.DIST_DIR }}/${{ env.PACKAGE_FILENAME }}
221221

222+
checksums:
223+
needs: notarize-macos
224+
runs-on: ubuntu-latest
225+
permissions:
226+
contents: read
227+
228+
steps:
229+
- name: Set environment variables
230+
run: |
231+
# See: https://docs.github.com/actions/reference/workflows-and-actions/workflow-commands#setting-an-environment-variable
232+
TAG="nightly-$(date -u +"%Y%m%d")"
233+
echo "CHECKSUM_FILE_PATH=${{ runner.temp }}/${TAG}-checksums.txt" >>"$GITHUB_ENV"
234+
echo "TAG=$TAG" >>"$GITHUB_ENV"
235+
236+
- name: Download artifacts
237+
uses: actions/download-artifact@v6
238+
with:
239+
merge-multiple: true
240+
path: ${{ env.DIST_DIR }}
241+
pattern: ${{ env.ARTIFACT_PREFIX }}*
242+
243+
- name: Create checksum file
244+
working-directory: ${{ env.DIST_DIR }}
245+
run: |
246+
sha256sum ${{ env.PROJECT_NAME }}_${{ env.TAG }}* >"${{ env.CHECKSUM_FILE_PATH }}"
247+
248+
- name: Upload checksum artifact
249+
uses: actions/upload-artifact@v5
250+
with:
251+
if-no-files-found: error
252+
name: ${{ env.ARTIFACT_PREFIX }}checksums
253+
path: ${{ env.CHECKSUM_FILE_PATH }}
254+
222255
publish-nightly:
223256
runs-on: ubuntu-latest
224257
environment: production
225-
needs: notarize-macos
258+
needs: checksums
226259
permissions:
227260
contents: write
228261
id-token: write # This is required for requesting the JWT
229262

230263
steps:
264+
- name: Determine whether publishing to AWS is possible
265+
id: aws-determination
266+
run: |
267+
echo "publish=${{ secrets.AWS_ROLE_TO_ASSUME != '' }}" >>$GITHUB_OUTPUT
268+
231269
- name: Download artifact
270+
if: steps.aws-determination.outputs.publish == 'true'
232271
uses: actions/download-artifact@v6
233272
with:
234273
pattern: ${{ env.ARTIFACT_PREFIX }}*
235274
merge-multiple: true
236275
path: ${{ env.DIST_DIR }}
237276

238-
- name: Create checksum file
239-
working-directory: ${{ env.DIST_DIR }}
240-
run: |
241-
TAG="nightly-$(date -u +"%Y%m%d")"
242-
sha256sum ${{ env.PROJECT_NAME }}_${TAG}* >${TAG}-checksums.txt
243-
244277
- name: configure aws credentials
278+
if: steps.aws-determination.outputs.publish == 'true'
245279
uses: aws-actions/configure-aws-credentials@v5
246280
with:
247281
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
248282
role-session-name: "github_${{ env.PROJECT_NAME }}"
249283
aws-region: ${{ env.AWS_REGION }}
250284

251285
- name: Upload release files on Arduino downloads servers
286+
if: steps.aws-determination.outputs.publish == 'true'
252287
run: |
253288
aws s3 sync \
254289
${{ 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 "publish=${{ secrets.AWS_ROLE_TO_ASSUME != '' }}" >>$GITHUB_OUTPUT
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)

AltStyle によって変換されたページ (->オリジナル) /