Skip to content

Commit

Permalink
github: Use IAM Roles to push files on AWS S3 (#45)
Browse files Browse the repository at this point in the history
For security reasons long lived credentials are not considered secure.
To overcome this issue we can configure Github Workflows to use AWS OpenID Connect instead:
For further details: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect
  • Loading branch information
alessio-perugini authored Dec 13, 2024
1 parent d2e5ccd commit e21fd39
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,17 @@ jobs:

create-release:
runs-on: ubuntu-latest
environment: production
needs: [build, build-go]
permissions:
contents: write
id-token: write # This is required for requesting the JWT
env:
TARGET: "/tools/"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: "us-east-1" # or https://github.com/aws/aws-cli/issues/5623
PROJECT_NAME: rp2040tools
steps:
- name: Checkout rp2040tools repository # we need package_index.template
uses: actions/checkout@v4
Expand Down Expand Up @@ -225,5 +230,12 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "release/*,package_index_draft.json"

- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: "github_${{ env.PROJECT_NAME }}"
aws-region: ${{ env.AWS_REGION }}

- name: Upload release files on Arduino downloads servers
run: aws s3 sync release/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }}

0 comments on commit e21fd39

Please sign in to comment.