Merge pull request #114 from nationalarchives/dev #75
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
name: Update frontend | |
on: | |
push: | |
paths: | |
- app/** | |
- .github/workflow/update-frontend.yml | |
branches: | |
- live | |
- stage | |
- dev | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
jobs: | |
update_site_env_matching_branch: | |
environment: ${{ github.ref_name }} | |
runs-on: ubuntu-latest | |
if: "! contains(toJSON(github.event.commits.*.message), '[ci skip]')" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/Role_Diagram_GitHub_OICD | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Install node dependencies | |
working-directory: ./app | |
run: npm ci | |
- name: Build static site | |
working-directory: ./app | |
run: npm run build | |
- name: Update static site hosted in S3 | |
run: aws s3 sync ./app/dist s3://${{ secrets.BUCKET_NAME }}/ --delete |