Skip to content

Commit

Permalink
fix testnet deploy (#1806)
Browse files Browse the repository at this point in the history
  • Loading branch information
yourmoonlight authored Jun 3, 2024
1 parent cf2659a commit 7c7d034
Showing 1 changed file with 31 additions and 6 deletions.
37 changes: 31 additions & 6 deletions .github/workflows/deploy_testnet.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,46 @@
name: Deploy TESTNET Seed
on:
release:
types: [released, prereleased]
workflow_dispatch:
inputs:
ref:
description: 'Tag or branch to deploy'
default: 'main'
workflow_run:
workflows: ["Build Docker And Deploy Seed"]
types:
- completed

jobs:
deploy-rooch-testnet:
name: deploy rooch testnet
name: Deploy Rooch Testnet
runs-on: self-hosted
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'release' && (github.event.release.prerelease == true || github.event.release.prerelease == false) }}
if: |
github.event_name == 'workflow_dispatch' ||
(github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'release' &&
(github.event.release.prerelease == true || github.event.release.prerelease == false))
steps:
- name: Extract version
id: extract-version
- name: Checkout code
uses: actions/checkout@v2

- name: Determine ref
id: determine-ref
run: |
printf "::set-output name=%s::%s\n" tag-name "${GITHUB_REF#refs/tags/}"
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "REF=${{ github.event.inputs.ref }}" >> $GITHUB_ENV
else
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
REF=${GITHUB_REF#refs/tags/}
elif [[ "${{ github.ref }}" == refs/heads/* ]]; then
REF=${GITHUB_REF#refs/heads/}
fi
echo "REF=$REF" >> $GITHUB_ENV
fi
- name: Print ref
run: echo "The ref is ${{ env.REF }}"
- name: Deploy to GCP TESTNET VM
env:
PRIVATE_KEY: ${{ secrets.GCP_TESTNET_SSH_PRIVATE_KEY }}
Expand All @@ -26,5 +51,5 @@ jobs:
chmod 600 private_key.pem
sudo apt update
sudo apt install -y --no-install-recommends openssh-server
ssh -o StrictHostKeyChecking=no -i private_key.pem $USER@$HOST bash -c "'sleep 30' && docker image prune -a -f && docker ps | grep rooch | awk '{print \$1}' | xargs -r docker stop && docker ps -a | grep rooch | awk '{print \$1}' | xargs -r docker rm -f && docker pull 'ghcr.io/rooch-network/rooch:${{ steps.extract-version.outputs.tag-name }}' && docker run -d --name rooch --restart unless-stopped -v /data:/root -p 50051:50051 'ghcr.io/rooch-network/rooch:${{ steps.extract-version.outputs.tag-name }}' server start -n test --btc-rpc-url '${{secrets.BTC_TEST_RPC_URL}}' --btc-rpc-username rooch-test --btc-rpc-password '${{secrets.BTC_TEST_RPC_PWD}}' --da '{\"internal-da-server\": {\"servers\": [{\"open-da\": {\"scheme\": \"gcs\", \"config\": {\"bucket\": \"${{secrets.OPENDA_GCP_TESTNET_BUCKET}}\", \"credential\": \"${{secrets.OPENDA_GCP_TESTNET_CREDENTIAL}}\"}}}]}}'"
ssh -o StrictHostKeyChecking=no -i private_key.pem $USER@$HOST bash -c "'sleep 30' && docker image prune -a -f && docker ps | grep rooch | awk '{print \$1}' | xargs -r docker stop && docker ps -a | grep rooch | awk '{print \$1}' | xargs -r docker rm -f && docker pull 'ghcr.io/rooch-network/rooch:${{ env.REF }}' && docker run -d --name rooch --restart unless-stopped -v /data:/root -p 50051:50051 'ghcr.io/rooch-network/rooch:${{ env.REF }}' server start -n test --btc-rpc-url '${{secrets.BTC_TEST_RPC_URL}}' --btc-rpc-username rooch-test --btc-rpc-password '${{secrets.BTC_TEST_RPC_PWD}}' --da '{\"internal-da-server\": {\"servers\": [{\"open-da\": {\"scheme\": \"gcs\", \"config\": {\"bucket\": \"${{secrets.OPENDA_GCP_TESTNET_BUCKET}}\", \"credential\": \"${{secrets.OPENDA_GCP_TESTNET_CREDENTIAL}}\"}}}]}}'"

0 comments on commit 7c7d034

Please sign in to comment.