Skip to content

Commit 5b2ddaf

Browse files
Merge pull request #6 from arduino/iam-roles
github: Use IAM Roles to push files on AWS S3
2 parents 176b46a + da25124 commit 5b2ddaf

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ env:
1111
ARTIFACT_NAME: dist
1212
# See: https://github.com/actions/setup-go/tree/main#supported-version-syntax
1313
GO_VERSION: "1.17"
14+
AWS_REGION: "us-east-1"
1415

1516
on:
1617
push:
@@ -73,7 +74,11 @@ jobs:
7374

7475
create-release:
7576
runs-on: ubuntu-latest
77+
environment: production
7678
needs: create-release-artifacts
79+
permissions:
80+
contents: write
81+
id-token: write # This is required for requesting the JWT
7782

7883
steps:
7984
- name: Download artifact
@@ -108,12 +113,12 @@ jobs:
108113
# (all the files we need are in the DIST_DIR root)
109114
artifacts: ${{ env.DIST_DIR }}/*
110115

116+
- name: configure aws credentials
117+
uses: aws-actions/configure-aws-credentials@v4
118+
with:
119+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
120+
role-session-name: "github_${{ env.PROJECT_NAME }}"
121+
aws-region: ${{ env.AWS_REGION }}
122+
111123
- name: Upload release files on Arduino downloads servers
112-
uses: docker://plugins/s3
113-
env:
114-
PLUGIN_SOURCE: "${{ env.DIST_DIR }}/*"
115-
PLUGIN_TARGET: ${{ env.AWS_PLUGIN_TARGET }}
116-
PLUGIN_STRIP_PREFIX: "${{ env.DIST_DIR }}/"
117-
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
118-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
119-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
124+
run: aws s3 sync ${{ env.DIST_DIR }} s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.AWS_PLUGIN_TARGET }}

0 commit comments

Comments
 (0)