Update ci.yml #10
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: ci | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install Dependencies | |
run: yarn | |
- name: Build | |
run: yarn build | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/giveth/givpower-bot:main | |
deploy: | |
needs: publish | |
runs-on: ubuntu-latest | |
steps: | |
- name: SSH and Redeploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
key: ${{ secrets.SSH_PRIVATEKEY }} | |
port: ${{ secrets.SSH_PORT }} | |
script: | | |
cd ~/givpower-bots/givpower-bot-optimism-production | |
docker compose stop givpower-bot | |
docker compose pull givpower-bot | |
docker compose up -d givpower-bot | |
cd ~/givpower-bots/givpower-bot-xdai-production | |
docker compose stop givpower-bot | |
docker compose pull givpower-bot | |
docker compose up -d givpower-bot | |
docker image prune -a --force |