Prevent context menu #142
Workflow file for this run
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: 'Main' | |
on: | |
pull_request: | |
branches: ['master'] | |
push: | |
branches: ['master'] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Restore cached dependencies | |
id: dependency-restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: node_modules/ | |
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} | |
- name: Install dependencies | |
run: npm i | |
- name: Save dependency cache | |
id: dependency-save | |
uses: actions/cache/save@v3 | |
with: | |
path: node_modules/ | |
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} | |
- name: Check formatting | |
run: npm run check-format | |
- name: Build | |
run: npm run build | |
# Upload repo with built files and dependencies for use in subsequent jobs | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: build | |
jest-tests: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Restore cached dependencies | |
id: dependency-restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: node_modules/ | |
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build | |
- name: Run unit tests | |
run: npm run test | |
deploy: | |
name: Deploy | |
needs: build | |
if: github.ref_name == 'master' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: build | |
path: build | |
- name: Set environment variables | |
run: export AWS_PAGER= | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.TOP90_AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.TOP90_AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Sync files to S3 | |
run: aws s3 sync build/ s3://www.top90.io | |
- name: Invalidate Caches | |
run: | | |
aws cloudfront create-invalidation --distribution-id E35J0ICF5X5SHZ --paths "/*" | |
aws cloudfront create-invalidation --distribution-id EECYMS9J1D029 --paths "/*" |