-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: automate deployment * refactor: remove warnings when building * ci: use Makefile when deploying * ci: Add new variable EXPLORER_SERVICE_BASE_URL during build * ci: add GTM_ID env var to Makefile
- Loading branch information
Showing
5 changed files
with
148 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: deploy | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
tags: ['v*'] | ||
|
||
jobs: | ||
dependencies: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Node.js 14.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
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: | ||
- uses: actions/checkout@v2 | ||
- name: Download node modules | ||
uses: actions/download-artifact@v2 | ||
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' | ||
deploy-mainnet-explorer: | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
needs: dependencies | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Download node modules | ||
uses: actions/download-artifact@v2 | ||
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' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,35 @@ | ||
FULLNODE_HOST := node1.bravo.testnet.hathor.network | ||
REACT_APP_BASE_URL := https://$(FULLNODE_HOST)/v1a/ | ||
REACT_APP_WS_URL := wss://$(FULLNODE_HOST)/v1a/ws/ | ||
|
||
.PHONY: build | ||
build: | ||
REACT_APP_WS_URL=$(REACT_APP_WS_URL) \ | ||
REACT_APP_BASE_URL=$(REACT_APP_BASE_URL) \ | ||
.PHONY: check_version | ||
check_version: | ||
./scripts/check_version | ||
|
||
.PHONY: check_tag | ||
check_tag: | ||
./scripts/check_tag | ||
|
||
.PHONY: testnet_build | ||
testnet_build: | ||
FULLNODE_HOST=node1.foxtrot.testnet.hathor.network; \ | ||
export REACT_APP_BASE_URL=https://$$FULLNODE_HOST/v1a/; \ | ||
export REACT_APP_WS_URL=wss://$$FULLNODE_HOST/v1a/ws/; \ | ||
export EXPLORER_SERVICE_BASE_URL=https://explorer-service.testnet.hathor.network/; / | ||
npm run build | ||
|
||
.PHONY: testnet_deploy | ||
testnet_deploy: | ||
check_version | ||
aws s3 sync --delete ./build/ s3://hathor-testnet-foxtrot-public-explorer | ||
|
||
.PHONY: mainnet_build | ||
mainnet_build: | ||
FULLNODE_HOST=node.explorer.hathor.network; \ | ||
export REACT_APP_BASE_URL=https://$$FULLNODE_HOST/v1a/; \ | ||
export REACT_APP_WS_URL=wss://$$FULLNODE_HOST/v1a/ws/; \ | ||
export REACT_APP_GTM_ID=GTM-MJVX6BG; / | ||
export EXPLORER_SERVICE_BASE_URL=https://explorer-service.hathor.network/; / | ||
npm run build | ||
|
||
.PHONY: s3_upload | ||
s3_upload: | ||
./s3_prod_upload | ||
.PHONY: mainnet_deploy | ||
mainnet_deploy: | ||
check_version | ||
check_tag | ||
aws s3 sync --delete ./build/ s3://hathor-mainnet-public-explorer |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
PACKAGE_VERSION=`grep '"version":' ./package.json | cut -d '"' -f4` | ||
GIT_TAG_VERSION=`git describe --abbrev=0 --tags` | ||
|
||
# For debugging: | ||
# echo x${PACKAGE_VERSION}x | ||
# echo x${GIT_TAG_VERSION}x | ||
|
||
EXITCODE=0 | ||
|
||
if [[ x${PACKAGE_VERSION}x != x${GIT_TAG_VERSION:1}x ]]; then | ||
echo Version different in package.json and git tag | ||
EXITCODE=-1 | ||
fi | ||
|
||
exit $EXITCODE |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
SRC_VERSION=`grep "const VERSION " ./src/constants.js | cut -d"'" -f2` | ||
PACKAGE_VERSION=`grep '"version":' ./package.json | cut -d '"' -f4` | ||
|
||
# For debugging: | ||
# echo x${SRC_VERSION}x | ||
# echo x${PACKAGE_VERSION}x | ||
|
||
EXITCODE=0 | ||
|
||
if [[ x${PACKAGE_VERSION}x != x${SRC_VERSION}x ]]; then | ||
echo Version different in package.json and src/constants.js | ||
EXITCODE=-1 | ||
fi | ||
|
||
exit $EXITCODE |