Skip to content

Commit

Permalink
ci: deploy to sub-accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
luislhl committed Jul 12, 2024
1 parent 10aa8d5 commit ad844c8
Show file tree
Hide file tree
Showing 2 changed files with 104 additions and 6 deletions.
76 changes: 70 additions & 6 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches: [master]
tags: ['v*']

permissions:
id-token: write
contents: read

jobs:
dependencies:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -47,6 +51,12 @@ jobs:
steps:
# https://github.com/actions/checkout/releases/tag/v3.5.3
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Configure AWS Credentials
# https://github.com/aws-actions/configure-aws-credentials/releases/tag/v4.0.2
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::769498303037:role/ExplorerGitHubActionsRole
- name: Download node modules
# https://github.com/actions/download-artifact/releases/tag/v3.0.2
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
Expand All @@ -60,17 +70,74 @@ jobs:
run: |
make testnet_deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-east-1'
CLOUDFRONT_ID: E2TGO5SVP34CC3
deploy-nano-testnet-explorer:
if: github.ref == 'refs/heads/master'
needs: dependencies
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout/releases/tag/v3.5.3
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Configure AWS Credentials
# https://github.com/aws-actions/configure-aws-credentials/releases/tag/v4.0.2
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
with:
aws-region: eu-central-1
role-to-assume: arn:aws:iam::471112952246:role/ExplorerGitHubActionsRole
- name: Download node modules
# https://github.com/actions/download-artifact/releases/tag/v3.0.2
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: node_modules
- name: Build
run: |
tar -xf node_modules.tar
make nano_testnet_build
- name: Deploy Nano Testnet Explorer
run: |
make nano_testnet_deploy
env:
CLOUDFRONT_ID: EN58551BWE3XZ
deploy-ekvilibro-testnet-explorer:
if: github.ref == 'refs/heads/master'
needs: dependencies
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout/releases/tag/v3.5.3
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Configure AWS Credentials
# https://github.com/aws-actions/configure-aws-credentials/releases/tag/v4.0.2
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
with:
aws-region: eu-central-1
role-to-assume: arn:aws:iam::730335348496:role/ExplorerGitHubActionsRole
- name: Download node modules
# https://github.com/actions/download-artifact/releases/tag/v3.0.2
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
with:
name: node_modules
- name: Build
run: |
tar -xf node_modules.tar
make ekvilibro_testnet_build
- name: Deploy Ekvilibro Testnet Explorer
run: |
make ekvilibro_testnet_deploy
env:
CLOUDFRONT_ID: E3SRP23QB7K3DQ
deploy-mainnet-explorer:
if: startsWith(github.ref, 'refs/tags/v')
needs: dependencies
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout/releases/tag/v3.5.3
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Configure AWS Credentials
# https://github.com/aws-actions/configure-aws-credentials/releases/tag/v4.0.2
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::769498303037:role/ExplorerGitHubActionsRole
- name: Download node modules
# https://github.com/actions/download-artifact/releases/tag/v3.0.2
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a
Expand All @@ -84,7 +151,4 @@ jobs:
run: |
make mainnet_deploy
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-east-1'
CLOUDFRONT_ID: ETOC9JKCK86OG
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,40 @@ check_version:
check_tag:
./scripts/check_tag

.PHONY: nano_testnet_build
nano_testnet_build:
FULLNODE_HOST=node1.nano-testnet.hathor.network; \
export REACT_APP_BASE_URL=https://$$FULLNODE_HOST/v1a/; \
export REACT_APP_WS_URL=wss://$$FULLNODE_HOST/v1a/ws/; \
export REACT_APP_EXPLORER_SERVICE_BASE_URL=https://explorer-service.nano-testnet.hathor.network/; \
export REACT_APP_TIMESERIES_DASHBOARD_ID=59683ac0-237a-11ef-8f75-578bca86e218; \
export REACT_APP_NETWORK=nano-testnet-alpha; \
npm run build

.PHONY: nano_testnet_s3_sync
nano_testnet_s3_sync:
aws s3 sync --delete ./build/ s3://hathor-nano-testnet-public-explorer-2 --profile nano-testnet

.PHONY: nano_testnet_deploy
nano_testnet_deploy: check_version nano_testnet_s3_sync clear_cloudfront_cache

.PHONY: ekvilibro_testnet_build
ekvilibro_testnet_build:
FULLNODE_HOST=node-side-dag.ekvilibro-testnet.hathor.network; \
export REACT_APP_BASE_URL=https://$$FULLNODE_HOST/v1a/; \
export REACT_APP_WS_URL=wss://$$FULLNODE_HOST/v1a/ws/; \
export REACT_APP_EXPLORER_SERVICE_BASE_URL=https://explorer-service.ekvilibro-testnet.hathor.network/; \
export REACT_APP_TIMESERIES_DASHBOARD_ID=; \
export REACT_APP_NETWORK=ekvilibro-testnet; \
npm run build

.PHONY: ekvilibro_testnet_s3_sync
ekvilibro_testnet_s3_sync:
aws s3 sync --delete ./build/ s3://hathor-ekvilibro-testnet-public-explorer --profile ekvilibro

.PHONY: ekvilibro_testnet_deploy
ekvilibro_testnet_deploy: check_version ekvilibro_testnet_s3_sync clear_cloudfront_cache

.PHONY: testnet_build
testnet_build:
FULLNODE_HOST=node.explorer.testnet.hathor.network; \
Expand Down

0 comments on commit ad844c8

Please sign in to comment.