Skip to content

Merge pull request #2386 from torusresearch/develop #160

Merge pull request #2386 from torusresearch/develop

Merge pull request #2386 from torusresearch/develop #160

Workflow file for this run

name: prod release
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [master]
jobs:
test:
name: Test release
strategy:
matrix:
node: ['20.x']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.ALPHA_SSH_KEY }}
- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Pre-build setup
run: npm run pre-build
- name: Run lint
run: npm run lint
- name: Running unit tests with coverage
run: npm run test:coverage-codecov
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
VUE_APP_INFURA_KEY: ${{ secrets.VUE_APP_INFURA_KEY }}
build-deploy-prod:
name: Build & deploy app.tor.us
strategy:
matrix:
node: ['20.x']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.ALPHA_SSH_KEY }}
- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- 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: us-east-1
- name: Install dependencies
run: npm install
- name: Run build
run: |
. ./scripts/setup.sh
npm version major -m 'Updating version to %s [skip ci]'
npm run build
. ./scripts/gitPush.sh
env:
VUE_APP_INFURA_KEY: ${{ secrets.VUE_APP_INFURA_KEY }}
GITHUB_SSH_KEY: ${{ secrets.ALPHA_SSH_KEY }}
- name: 'Upload source to Sentry'
run: |
. ./scripts/uploadToSentry.sh
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
- name: 'Delete sourcemaps'
run: rm ./dist/js/*.js.map
# Upload to S3
- name: Run AWS actions
run: |
. ./scripts/uploadToAws.sh
. ./scripts/updateLambda.sh
. ./scripts/updateIframeIntegrity.sh
env:
GITHUB_SSH_KEY: ${{ secrets.ALPHA_SSH_KEY }}
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.DISTRIBUTION_APP_TOR_US }}
build-deploy-bnb:
name: Build & deploy bnb.tor.us
strategy:
matrix:
node: ['20.x']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Run build
run: npm run build:bnb
env:
VUE_APP_INFURA_KEY: ${{ secrets.VUE_APP_INFURA_KEY }}
- 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: us-east-1
# Upload to S3
- name: sync s3
uses: jakejarvis/s3-sync-action@master
env:
SOURCE_DIR: 'dist'
AWS_REGION: 'us-east-1'
AWS_S3_BUCKET: 'bnb.tor.us'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Invalidate Cloudfront (this action)
- name: invalidate
uses: chaitanyapotti/cloudfront-update-distribution@v4
with:
cloudfront-distribution-id: ${{ secrets.DISTRIBUTION_BNB_TOR_US }}
cloudfront-invalidation-path: '/*'
cloudfront-invalidation-required: true
cloudfront-wait-for-service-update: false
build-deploy-polygon:
name: Build & deploy polygon.tor.us
strategy:
matrix:
node: ['20.x']
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Run build
run: npm run build:polygon
env:
VUE_APP_INFURA_KEY: ${{ secrets.VUE_APP_INFURA_KEY }}
- 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: us-east-1
# Upload to S3
- name: sync s3
uses: jakejarvis/s3-sync-action@master
env:
SOURCE_DIR: 'dist'
AWS_REGION: 'us-east-1'
AWS_S3_BUCKET: 'polygon.tor.us'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
# Invalidate Cloudfront (this action)
- name: invalidate
uses: chaitanyapotti/cloudfront-update-distribution@v4
with:
cloudfront-distribution-id: ${{ secrets.DISTRIBUTION_POLYGON_TOR_US }}
cloudfront-invalidation-path: '/*'
cloudfront-invalidation-required: true
cloudfront-wait-for-service-update: false