2.1.0 #45
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: Deploy to production | |
on: | |
push: | |
tags: | |
- v* | |
concurrency: | |
group: production | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
name: Build and deploy to production | |
environment: | |
name: production | |
url: https://streamr.network/network-explorer | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
cache-dependency-path: 'package-lock.json' | |
- name: Set npm access token | |
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Get version string from git tag name | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} | |
- name: Print version string | |
run: echo ${{ steps.get_version.outputs.VERSION }} | |
- name: Build app with production environment variables | |
env: | |
NODE_ENV: production | |
VERSION: ${{ steps.get_version.outputs.VERSION }} | |
REACT_APP_DEFAULT_ENV: brubeck | |
REACT_APP_PUBLIC_URL: https://network-explorer-cdn.streamr.network | |
REACT_APP_BASENAME: /network-explorer | |
REACT_APP_MAPBOX_TOKEN: pk.eyJ1Ijoic3RyZWFtci1uZSIsImEiOiJja3Q0M29zOGkwNmt2MzFwN2d1OWthc2Z4In0.np5n6kX7ea0ig_5TUXdXbw | |
run: npm run build --if-present | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-1 | |
- name: Deploy to S3 | |
run: | | |
aws s3 sync build/. s3://eu-west-1-streamr-network-explorer-cdn --acl private | |
- name: Invalidate Cloudfront cache | |
run: | | |
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION_ID }} --paths "/*" |