Skip to content

Add base config

Add base config #2144

Workflow file for this run

name: Deploy
concurrency:
group: deploy-${{github.ref}}
cancel-in-progress: true
on:
push:
branches:
- "**"
release:
types:
- created
jobs:
deploy:
if: github.event_name == 'release' || github.ref == 'refs/heads/main' || contains(github.event.head_commit.message, '[stagingdeploy]') || contains(github.event.head_commit.message, '[testnetdeploy]') || contains(github.event.head_commit.message, '[mainnetdeploy]')
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
shell: bash
id: prep
run: |
# This is the official way to setup secret values that are multi-line, such as an SSH private key.
echo 'vm_ssh_key<<EOF' >> $GITHUB_ENV
echo "${{ secrets.VM_SSH_KEY }}" >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- if: contains(github.event.head_commit.message, '[stagingdeploy]')
name: Deploy staging
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.STAGING_VM_HOST }}
username: validator
key: ${{ env.vm_ssh_key }}
port: 22
script_stop: true
command_timeout: 30m
script: |
cd go-tableland
git fetch && git checkout -f ${{ github.sha }}
cd docker
HEALTHBOT_ENABLED=true make staging-up
# Wait to start and double-check we're running the expected version.
# This helps having a green check in the GH Action be high-signal that everything is fine.
sleep 5;
for i in 1 2 3 4; do [ $(curl --insecure --silent https://127.0.0.1/api/v1/version | jq .git_commit) = "\"${{ steps.prep.outputs.sha_short}}\"" ] && break || (if [ $i = 4 ]; then exit -1; else sleep 5; fi ) done
echo "All healthy!"
- if: github.ref == 'refs/heads/main' || contains(github.event.head_commit.message, '[testnetdeploy]')
name: Deploy testnet
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.TESTNET_V2_VM_HOST }}
username: validator
key: ${{ env.vm_ssh_key }}
port: 22
script_stop: true
command_timeout: 30m
script: |
cd go-tableland
git fetch && git checkout -f ${{ github.sha }}
cd docker
HEALTHBOT_ENABLED=true make testnet-up
# Wait to start and double-check we're running the expected version.
# This helps having a green check in the GH Action be high-signal that everything is fine.
sleep 5;
for i in 1 2 3 4; do [ $(curl --insecure --silent https://127.0.0.1/api/v1/version | jq .git_commit) = "\"${{ steps.prep.outputs.sha_short}}\"" ] && break || (if [ $i = 4 ]; then exit -1; else sleep 5; fi ) done
echo "All healthy!"
- if: github.event_name == 'release' || contains(github.event.head_commit.message, '[mainnetdeploy]')
name: Deploy mainnet
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.MAINNET_VM_HOST }}
username: validator
key: ${{ env.vm_ssh_key }}
port: 22
script_stop: true
command_timeout: 30m
script: |
cd go-tableland
git fetch && git checkout -f ${{ github.sha }}
cd docker
make mainnet-up
# Wait to start and double-check we're running the expected version.
# This helps having a green check in the GH Action be high-signal that everything is fine.
sleep 5;
for i in 1 2 3 4; do [ $(curl --insecure --silent https://127.0.0.1/api/v1/version | jq .git_commit) = "\"${{ steps.prep.outputs.sha_short}}\"" ] && break || (if [ $i = 4 ]; then exit -1; else sleep 5; fi ) done
echo "All healthy!"