.github/workflows/oidc-sync.yml #14
This file contains 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
on: | |
workflow_dispatch: | |
env: | |
STACK: WwwDevStack | |
ROLE: arn:aws:iam::510094580976:role/hello.dev-repo | |
jobs: | |
deploy: | |
name: Upload to Amazon S3 | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install modules | |
run: npm install | |
# TODO - cache the install? | |
- name: Configure web-sync AWS credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
role-to-assume: $ROLE | |
aws-region: us-west-2 | |
- name: Build content | |
run: npm run build | |
- name: Copy docs dir to S3 bucket with the AWS CLI | |
run: | | |
BUCKET_NAME=$(aws cloudformation describe-stacks --stack-name $STACK --query 'Stacks[0].Outputs[?OutputKey==`BucketNameOutput`].OutputValue' --output text) | |
aws s3 sync docs/ s3://${BUCKET_NAME}/ | |
- name: Invalidate CloudFront cache | |
run: | | |
DISTRIBUTION_ID=$(aws cloudformation describe-stacks --stack-name $STACK --query 'Stacks[0].Outputs[?OutputKey==`DistributionIdOutput`].OutputValue' --output text) | |
aws cloudfront create-invalidation --distribution-id ${DISTRIBUTION_ID} --paths "/*" |