Skip to content

Commit

Permalink
Merge pull request #78 from lesteenman/discord-components
Browse files Browse the repository at this point in the history
Use OIDC to get deployment credentials
  • Loading branch information
lesteenman authored Nov 15, 2022
2 parents c8f25e9 + 7c2adf2 commit 4cadee2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ jobs:
needs: build
runs-on: ubuntu-latest
environment: Production
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v3

Expand Down Expand Up @@ -125,13 +128,15 @@ jobs:
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
NOTIFICATION_EMAIL: ${{ secrets.NOTIFICATION_EMAIL }}

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_DEPLOYMENT_ROLE }}
role-session-name: github-actions-deployment
aws-region: ${{ secrets.AWS_REGION }}

- name: Deploy CDK
run: cd infra && poetry run npx cdk deploy --app ./build/cdk.out --require-approval never
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_TARGET_ACCOUNT: ${{ secrets.AWS_TARGET_ACCOUNT }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

release:
needs: deploy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
if: steps.cached-infra-poetry.outputs.cache-hit != 'true'

- name: Synthesize CDK
run: cd infra && poetry run npx cdk synth -vvv --output build/cdk.out
run: cd infra && poetry run npx cdk synth --output build/cdk.out
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down

0 comments on commit 4cadee2

Please sign in to comment.