Due to OAuth token scope limitations, these changes must be applied manually via GitHub UI or with a token that has workflow scope.
jobs:
build-and-push:
name: Build and Push Docker Image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write # ADD THIS LINEdeploy:
name: Deploy to Production
runs-on: ubuntu-latest
needs: [build-and-push, deploy-approval]
permissions:
id-token: write # ADD THIS LINE
contents: read # ADD THIS LINE
environment:
name: production
url: https://api.brain-storm.example.comrollback:
name: Rollback on Failure
runs-on: ubuntu-latest
needs: [build-and-push, deploy]
if: failure()
permissions:
id-token: write # ADD THIS LINE
contents: read # ADD THIS LINE
environment:
name: productionReplace all instances of:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}With:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
role-session-name: GitHubActions-BrainStorm-Production # or -Rollback for rollback job
aws-region: ${{ secrets.AWS_REGION }}After applying workflow changes:
-
Add new secrets:
AWS_ROLE_ARN: IAM role ARN (e.g.,arn:aws:iam::123456789012:role/GitHubActionsDeploymentRole)AWS_REGION: AWS region (e.g.,us-east-1)
-
Delete old secrets:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_ROLE_TO_ASSUME(if exists)
See docs/aws-oidc.md for full AWS IAM OIDC setup instructions.