Skip to content

Commit 2ad8b87

Browse files
authored
use OIDC to retrieve the credentials (#2541)
1 parent 20b9ba1 commit 2ad8b87

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

Diff for: .github/workflows/publish-go-nightly-task.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ env:
88
DIST_DIR: dist
99
# The project's folder on Arduino's download server for uploading builds
1010
AWS_PLUGIN_TARGET: /arduino-cli/
11+
AWS_REGION: "us-east-1"
1112
ARTIFACT_NAME: dist
1213

1314
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
@@ -18,6 +19,10 @@ on:
1819
workflow_dispatch:
1920
repository_dispatch:
2021

22+
permissions:
23+
id-token: write # This is required for requesting the JWT
24+
contents: read # This is required for actions/checkout
25+
2126
jobs:
2227
create-nightly-artifacts:
2328
outputs:
@@ -258,15 +263,20 @@ jobs:
258263
VERSION=${{ needs.create-nightly-artifacts.outputs.version }}
259264
sha256sum ${{ env.PROJECT_NAME }}_${VERSION}* > ${VERSION}-checksums.txt
260265
266+
- name: configure aws credentials
267+
uses: aws-actions/configure-aws-credentials@v4
268+
with:
269+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
270+
role-session-name: "github_${{ env.PROJECT_NAME }}"
271+
aws-region: ${{ env.AWS_REGION }}
272+
261273
- name: Upload release files on Arduino downloads servers
262274
uses: docker://plugins/s3
263275
env:
264276
PLUGIN_SOURCE: "${{ env.DIST_DIR }}/*"
265277
PLUGIN_TARGET: "${{ env.AWS_PLUGIN_TARGET }}nightly"
266278
PLUGIN_STRIP_PREFIX: "${{ env.DIST_DIR }}/"
267279
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
268-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
269-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
270280

271281
report:
272282
runs-on: ubuntu-latest

Diff for: .github/workflows/release-go-task.yml

+12-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@ env:
88
DIST_DIR: dist
99
# The project's folder on Arduino's download server for uploading builds
1010
AWS_PLUGIN_TARGET: /arduino-cli/
11+
AWS_REGION: "us-east-1"
1112
ARTIFACT_NAME: dist
1213

1314
on:
1415
push:
1516
tags:
1617
- "v[0-9]+.[0-9]+.[0-9]+*"
1718

19+
permissions:
20+
id-token: write # This is required for requesting the JWT
21+
contents: read # This is required for actions/checkout
22+
1823
jobs:
1924
create-release-artifacts:
2025
outputs:
@@ -283,15 +288,20 @@ jobs:
283288
# (all the files we need are in the DIST_DIR root)
284289
artifacts: ${{ env.DIST_DIR }}/*
285290

291+
- name: configure aws credentials
292+
uses: aws-actions/configure-aws-credentials@v4
293+
with:
294+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
295+
role-session-name: "github_${{ env.PROJECT_NAME }}"
296+
aws-region: ${{ env.AWS_REGION }}
297+
286298
- name: Upload release files on Arduino downloads servers
287299
uses: docker://plugins/s3
288300
env:
289301
PLUGIN_SOURCE: "${{ env.DIST_DIR }}/*"
290302
PLUGIN_TARGET: ${{ env.AWS_PLUGIN_TARGET }}
291303
PLUGIN_STRIP_PREFIX: "${{ env.DIST_DIR }}/"
292304
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
293-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
294-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
295305

296306
- name: Update Homebrew formula
297307
if: steps.prerelease.outputs.IS_PRE != 'true'

0 commit comments

Comments
 (0)