Skip to content

Commit

Permalink
Add autodeploy 2
Browse files Browse the repository at this point in the history
  • Loading branch information
semeniak97mf committed Oct 28, 2024
1 parent f23999e commit 385e4a4
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/deploy-devnet.yml
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

0 comments on commit 385e4a4

Please sign in to comment.