-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f23999e
commit 385e4a4
Showing
1 changed file
with
58 additions
and
0 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,58 @@ | ||
name: Deploy Devnet | ||
|
||
on: | ||
push: | ||
branches: [ "test/devnet-update" ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install system deps | ||
run: sudo apt-get install jq gettext | ||
|
||
- name: Set up SSH | ||
run: | | ||
mkdir -p ~/.ssh/ | ||
touch ~/.ssh/known_hosts | ||
ssh-keyscan ${{ secrets.DEVNET_HOST }} >> ~/.ssh/known_hosts | ||
echo "${{ secrets.DEVNET_PRIVATE_KEY }}" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
eval $(ssh-agent) | ||
- name: Authenticate GitHub CLI and download latest release of chainspec | ||
run: | | ||
gh auth login --with-token <<< "${{ secrets.ACCESS_TOKEN }}" | ||
LATEST_RELEASE=$(gh release list --repo Atleta-network/atleta --json tagName,createdAt --jq '.[] | select(.tagName | startswith("devnet-chainspec")) | .tagName' | sort -r | head -n 1) | ||
echo "${LATEST_RELEASE}" | ||
gh release download "${LATEST_RELEASE}" --repo Atleta-network/atleta --pattern "chain-spec.devnet.json" --dir chainspecs | ||
- name: Generate config.env | ||
run: | | ||
touch devnet/docker_conf.env | ||
echo "TELEMETRY_DOMAIN=${{ secrets.TELEMETRY_DOMAIN }}" >> devnet/docker_conf.env | ||
- name: Copy Files to Server | ||
run: | | ||
scp devnet/docker-compose.yml ${{ secrets.DEVNET_USERNAME }}@${{ secrets.DEVNET_HOST }}:/sportchain/docker-compose.yml | ||
scp devnet/docker_conf.env ${{ secrets.DEVNET_USERNAME }}@${{ secrets.DEVNET_HOST }}:/sportchain/docker_conf.env | ||
scp chainspecs/chain-spec.devnet.json ${{ secrets.DEVNET_USERNAME }}@${{ secrets.DEVNET_HOST }}:/sportchain/chainspec.json | ||
ssh -o StrictHostKeyChecking=no ${{ secrets.DEVNET_USERNAME }}@${{ secrets.DEVNET_HOST }} "mkdir -p /sportchain/process-exporter" | ||
scp utils/telemetry/process-exporter/process-exporter.yml ${{ secrets.DEVNET_USERNAME }}@${{ secrets.DEVNET_HOST }}:/sportchain/process-exporter/process-exporter.yml | ||
- name: SSH into Server and Deploy | ||
uses: appleboy/ssh-action@v1.0.3 | ||
with: | ||
host: ${{ secrets.DEVNET_HOST }} | ||
username: ${{ secrets.DEVNET_USERNAME }} | ||
key: ${{ secrets.DEVNET_PRIVATE_KEY }} | ||
script: | | ||
cd /sportchain | ||
docker compose down | ||
docker compose pull | ||
docker compose --env-file docker_conf.env up --detach --build --remove-orphans |