Update production testnet #167
Workflow file for this run
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
name: Validator Validation | |
on: | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
tag-image: | |
runs-on: ubuntu-latest | |
outputs: | |
image_tag: ${{ steps.image-tag.outputs.tag }} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Create image tag | |
id: image-tag | |
run: echo "tag=ghcr.io/gear-tech/node:0.1.0-`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_OUTPUT | |
update-validator: | |
runs-on: [kuberunner] | |
needs: tag-image | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Echo tag | |
run: echo ${{ needs.tag-image.outputs.image_tag }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
push: true | |
tags: ghcr.io/gear-tech/node:latest, ${{ needs.tag-image.outputs.image_tag }} | |
- name: SSH into VM | |
uses: appleboy/[email protected] | |
env: | |
GITHUB_IMAGE_TAG: ${{ needs.tag-image.outputs.image_tag }} | |
with: | |
host: ${{ secrets.VARA_VALIDATOR_8 }} | |
username: ${{ secrets.SSH_VARA_USERNAME }} | |
key: ${{ secrets.VARA_SSH_PRIVATE_KEY }} | |
envs: GITHUB_IMAGE_TAG | |
script: | | |
sudo docker-compose -f /home/gear/docker-compose.yaml down | |
sudo sed -i 's|"ghcr.io/gear-tech/node:.*"|$GITHUB_IMAGE_TAG|' /home/gear/docker-compose.yaml | |
sudo docker-compose -f /home/gear/docker-compose.yaml up -d |