Use CDN link for static assets #28
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
# This workflow deploys application to the AWS PRD environment. | |
# Runs on each pull request to "master" branch. | |
name: Deploy PRD | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node.js 16.x | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 16.x | |
- name: Reconfigure git to use HTTP authentication | |
run: > | |
git config --global url."https://github.com/".insteadOf | |
ssh://[email protected]/ | |
- name: Cache Node.js modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.OS }}-node- | |
${{ runner.OS }}- | |
- run: node --version | |
- run: npm --version | |
- run: npm ci --no-optional | |
- run: npm run build | |
- run: npm run lint | |
- run: npm test | |
env: | |
CI: true | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-central-1 | |
- name: Copy files to the test website with the AWS CLI | |
run: | | |
aws s3 sync ./build/ s3://mri-viewer-prd --delete | |
- name: Invalidate cache with the AWS CLI | |
run: | | |
aws cloudfront create-invalidation --distribution-id E3O0OMPB0HHSIG --paths "/*" |