script update #2
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: release | |
on: | |
push: | |
branches: [new-runner-setup] | |
jobs: | |
build_and_upload: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache node modules | |
id: cache-npm | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | |
name: List the state of node modules | |
continue-on-error: true | |
run: npm list | |
- name: Install dependencies | |
run: npm ci --legacy-peer-deps | |
- name: Build | |
run: npm run build | |
env: | |
REACT_APP_API_EP: ${{ secrets.REACT_APP_API_EP }} | |
REACT_APP_API_KEY: ${{ secrets.REACT_APP_API_KEY }} | |
REACT_APP_GA_ID: ${{ secrets.REACT_APP_GA_ID }} | |
REACT_APP_RPC_MAINNET: ${{ secrets.REACT_APP_RPC_MAINNET }} | |
REACT_APP_RPC_DEVNET: ${{ secrets.REACT_APP_RPC_DEVNET }} | |
REACT_APP_CACHE_ENABLE: ${{ secrets.REACT_APP_CACHE_ENABLE }} | |
REACT_APP_REFRESH_AFTER_MINS: ${{ secrets.REACT_APP_REFRESH_AFTER_MINS }} | |
REACT_APP_REFRESH_FEED_AFTER_SECS: ${{ secrets.REACT_APP_REFRESH_FEED_AFTER_SECS }} | |
REACT_APP_BACKEND_EP: ${{ secrets.REACT_APP_BACKEND_EP }} | |
REACT_APP_SHARE_MSG: ${{ secrets.REACT_APP_SHARE_MSG }} | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Upload build to S3 | |
run: | | |
aws s3 sync ./out s3://${{ secrets.AWS_BUCKET }} \ | |
--delete | |
env: | |
AWS_BUCKET: ${{ secrets.AWS_BUCKET }} | |
# - name: Invalidate CloudFront Cache | |
# run: | | |
# aws cloudfront create-invalidation \ | |
# --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} \ | |
# --paths "/*" | |
# env: | |
# CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} |