Update secrets for GA #1
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: Build and Publish Arena Site | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'deploy' | |
jobs: | |
rapid: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Set environment variables | |
# if: github.ref == 'refs/heads/deploy' | |
uses: allenevans/[email protected] | |
with: | |
ARENA_S3_BUCKET: ${{ secrets.ARENA_S3_BUCKET }} | |
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} | |
NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN: ${{ secrets.NEXT_PUBLIC_MAPBOX_ACCESS_TOKEN }} | |
NEXT_PUBLIC_MAPBOX_STYLE_EXPLORE: ${{ secrets.NEXT_PUBLIC_MAPBOX_STYLE_EXPLORE }} | |
NEXT_PUBLIC_DATA_API: ${{ secrets.NEXT_PUBLIC_DATA_API }} | |
- name: Checkout current repository | |
uses: actions/checkout@v2 | |
with: | |
path: web_app | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18 | |
- name: Cache node modules | |
id: cache-node-modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: web_app/node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('web_app/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install modules | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: | | |
cd web_app | |
npm install | |
- name: Build rapid frontend | |
run: | | |
cd web_app | |
npm run build | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: '3.8' | |
- name: Install aws cli | |
run: | | |
python -m pip install --upgrade pip | |
pip install awscli | |
- name: Push data to S3 and clean CloudFront cache | |
if: ${{ success() }} | |
run: | | |
aws s3 sync web_app/out/ s3://${{ env.ARENA_S3_BUCKET }}/ --acl public-read --delete | |
aws cloudfront create-invalidation --distribution-id=${{ env.CLOUDFRONT_DISTRIBUTION_ID }} --paths=/ | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |