Skip to content

git pull merge

git pull merge #16

name: Deploy all code files for SPEAR site to S3
on:
push:
branches:
- 'erin-dev'
paths:
- '.github/workflows/all_code_to_s3.yml'
permissions:
id-token: write
contents: read
env:
BUCKET_NAME: spear-erin-dev
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_DEV_SPEAR_ARN }}
aws-region: ${{ secrets.AWS_REGION }}
role-session-name: GitHub-OIDC-spear-erin-dev
# Step 3: Files to S3
# This will add and overwrite all non data folder files to the S3 bucket but not delete files in S3 that have been deleted in the repo
- name: Sync files in S3
if: success()
run: |
aws s3 sync ./ s3://$BUCKET_NAME --exact-timestamps --exclude "data/*" --exclude ".github/*" --exclude "aggregate/*" --exclude ".git/*" --exclude "dev-neptune-queries/*"
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
BUCKET_NAME: ${{ env.BUCKET_NAME }}
- name: Invalidate CloudFront Cache
run: |
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.DEV_SPEAR_CLOUDFRONT_DISTRIBUTION_ID}} \
--paths "/*"
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}