feat(gha): Set workflow permissions for OIDC (#27) #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| permissions: | |
| id-token: write # Required to authenticate with ECR | |
| contents: write # Required to create tags & GitHub Releases | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ${{ github.workflow }}-release-${{ github.ref_name }} | |
| cancel-in-progress: false | |
| environment: | |
| name: release-ecr | |
| steps: | |
| # Use a merge queue to avoid `main` commit race conditions. | |
| - name: Checkout release branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.ref_name }} | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v6.4.3 | |
| - name: Setup packages | |
| run: uv run task setup | |
| - name: Build image | |
| run: uv run task build | |
| - name: Show OIDC | |
| uses: github/actions-oidc-debugger@018a1dc4f8e47adca924d55e4bb0ddce917af32d | |
| with: | |
| audience: sts.amazonaws.com | |
| - name: Setup AWS | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-region: ${{ vars.AWS_REGION }} | |
| role-to-assume: ${{ vars.AWS_ROLE_ARN }} | |
| role-session-name: github-actions-release-ecr | |
| - name: Release image | |
| run: uv run task release-ecr-no-build |