Skip to content

Commit 3044ec7

Browse files
authored
Merge pull request #67 from arduino/iam-roles
Use IAM Roles to push files on AWS S3.
2 parents f1af382 + f3325bb commit 3044ec7

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

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

Lines changed: 12 additions & 8 deletions
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: /discovery/mdns-discovery/
11+
AWS_REGION: "us-east-1"
1112
ARTIFACT_PREFIX: dist-
1213

1314
on:
@@ -185,7 +186,10 @@ jobs:
185186

186187
create-release:
187188
runs-on: ubuntu-latest
189+
environment: production
188190
needs: notarize-macos
191+
permissions:
192+
id-token: write # This is required for requesting the JWT
189193

190194
steps:
191195
- name: Download artifact
@@ -229,12 +233,12 @@ jobs:
229233
# (all the files we need are in the DIST_DIR root)
230234
artifacts: ${{ env.DIST_DIR }}/*
231235

236+
- name: configure aws credentials
237+
uses: aws-actions/configure-aws-credentials@v4
238+
with:
239+
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
240+
role-session-name: "github_${{ env.PROJECT_NAME }}"
241+
aws-region: ${{ env.AWS_REGION }}
242+
232243
- name: Upload release files on Arduino downloads servers
233-
uses: docker://plugins/s3
234-
env:
235-
PLUGIN_SOURCE: "${{ env.DIST_DIR }}/*"
236-
PLUGIN_TARGET: ${{ env.AWS_PLUGIN_TARGET }}
237-
PLUGIN_STRIP_PREFIX: "${{ env.DIST_DIR }}/"
238-
PLUGIN_BUCKET: ${{ secrets.DOWNLOADS_BUCKET }}
239-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
240-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
244+
run: aws s3 sync ${{ env.DIST_DIR }} s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.AWS_PLUGIN_TARGET }}

0 commit comments

Comments
 (0)