Merge pull request #264 from HathorNetwork/dev #81
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 | |
on: | |
push: | |
branches: [master] | |
tags: ['v*'] | |
jobs: | |
dependencies: | |
runs-on: ubuntu-latest | |
steps: | |
# https://github.com/actions/checkout/releases/tag/v3.5.3 | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 | |
- name: Set up Node.js 18.x | |
# https://github.com/actions/setup-node/releases/tag/v3.7.0 | |
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 | |
with: | |
node-version: 18.x | |
- name: Cache node modules | |
# https://github.com/actions/cache/releases/tag/v3.3.1 | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: /home/runner/work/hathor-explorer/hathor-explorer/node_modules | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Install Dependencies | |
run: | | |
npm install | |
tar -cvf node_modules.tar ./node_modules | |
- name: Upload node modules | |
uses: actions/upload-artifact@v2 | |
with: | |
name: node_modules | |
path: node_modules.tar | |
if-no-files-found: error | |
retention-days: 1 | |
deploy-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: 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 testnet_build | |
- name: Deploy Testnet Explorer | |
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-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: 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 mainnet_build | |
- name: Deploy Mainnet Explorer | |
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 |