Skip to content

Workflow file for this run

name: 'Deploy to staging'
on:
release:
types:
- created
env:
NODE_VERSION: 18.16.0
ENV: stage
AWS_EC2_METADATA_DISABLED: true
jobs:
frontend_deploy_stage:
runs-on: ubuntu-20.04
timeout-minutes: 15
env:
BUCKET_NAME: www-staging-aldnr.rumblefish.dev.evm-debugger
PREFIX: evm-debugger
if: |
startsWith(github.ref, 'refs/tags/@evm-debuger/frontend') &&
contains(github.ref, '-alpha.')
permissions:
id-token: write
contents: read
steps:
- name: 'Checkout'
uses: actions/[email protected]
- uses: actions/setup-node@master
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://npm.pkg.github.com'
scope: "@rumblefishdev"
- name: 'Cache NPM dependencies'
uses: pat-s/[email protected]
with:
path: |
**/node_modules
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('packages/*/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-npm-cache-
- name: Install dependencies
run: |
npm i
node_modules/.bin/lerna bootstrap
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 'Build'
run: |
npm run types:build
npm run analyzer:build
npm run frontend:build:stage
env:
REACT_APP_STRAPI_AUTH_TOKEN: ${{ secrets.STRAPI_AUTH_TOKEN }}
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::428196107266:role/evm-debugger-frontend-deploy-stage
aws-region: us-east-1
role-session-name: ${{ github.event.repository.name }}-${{ github.job }}
- name: 'Deploy'
run: |
aws s3 sync packages/frontend/build s3://${BUCKET_NAME}/${PREFIX} --delete --exact-timestamps
- name: Assume role on main AWS account
run: |
role_name=$(aws cloudformation describe-stacks --stack-name evm-transaction-trace-stage | jq -r '.Stacks[0].Parameters | map(select(.ParameterKey == "CloudfrontInvalidationRoleArn"))[0].ParameterValue')
output=$(aws sts assume-role --role-arn "$role_name" --role-session-name github-stage-frontend-Session)
echo "AWS_ACCESS_KEY_ID=$(echo $output | jq -r '.Credentials.AccessKeyId')" >> $GITHUB_ENV
echo "AWS_SECRET_ACCESS_KEY=$(echo $output | jq -r '.Credentials.SecretAccessKey')" >> $GITHUB_ENV
echo "AWS_SESSION_TOKEN=$(echo $output | jq -r '.Credentials.SessionToken')" >> $GITHUB_ENV
- name: Invalidate CloudFront
run: |
aws cloudfront create-invalidation --distribution-id ${DISTRIBUTION_ID} --paths "/${PREFIX}/*"
env:
DISTRIBUTION_ID: E1TRXMZGQSBIBH
transaction_trace_deploy_stage:
runs-on: ubuntu-20.04
if: |
startsWith(github.ref, 'refs/tags/@evm-debuger/transaction-trace') &&
contains(github.ref, '-alpha.')
permissions:
id-token: write
contents: read
steps:
- name: 'Checkout'
uses: actions/[email protected]
- uses: actions/setup-node@master
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Cache NPM dependencies'
uses: pat-s/[email protected]
with:
path: |
**/node_modules
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('packages/*/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-npm-cache-
- name: Install dependencies
run: |
npm i
npm install jq.node -g
node_modules/.bin/lerna bootstrap
- name: Build
run: |
npm run types:build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::428196107266:role/evm-debugger-transaction-trace-deploy-stage
aws-region: us-east-1
role-session-name: ${{ github.event.repository.name }}-${{ github.job }}
- name: Deploy stack
working-directory: ./packages/infra
run: |
make stage-deploy
srcmap_compiler_deploy_stage:
runs-on: ubuntu-20.04
if: |
startsWith(github.ref, 'refs/tags/@evm-debuger/srcmap-compiler') &&
contains(github.ref, '-alpha.')
permissions:
id-token: write
contents: read
steps:
- name: 'Checkout'
uses: actions/[email protected]
- uses: actions/setup-node@master
with:
node-version: ${{ env.NODE_VERSION }}
- name: 'Cache NPM dependencies'
uses: pat-s/[email protected]
with:
path: |
**/node_modules
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('packages/*/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-npm-cache-
- name: Install dependencies
run: |
npm i
npm install jq.node -g
node_modules/.bin/lerna bootstrap
- name: Build
run: |
npm run types:build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::428196107266:role/evm-debugger-srcmap-deploy-stage
aws-region: us-east-1
role-session-name: ${{ github.event.repository.name }}-${{ github.job }}
- name: Deploy stack
working-directory: ./packages/infra/compiler
run: |
make stage-deploy-all