From 85d6fe00707de8bb151d9ff38e898a36d781fc48 Mon Sep 17 00:00:00 2001 From: jackchuong Date: Fri, 17 Nov 2023 09:15:27 +0700 Subject: [PATCH] add homepage deploy workflow --- .github/workflows/homepage-deploy.yml | 30 ++++++++++++++++++++++ docker-configs/docker-compose.template.yml | 3 ++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/homepage-deploy.yml diff --git a/.github/workflows/homepage-deploy.yml b/.github/workflows/homepage-deploy.yml new file mode 100644 index 0000000..35aa182 --- /dev/null +++ b/.github/workflows/homepage-deploy.yml @@ -0,0 +1,30 @@ +name: deploy homepage +run-name: ${{ github.actor }} is deploying homepage 🚀 +on: + workflow_dispatch: +jobs: + restart-api-service: + runs-on: ubuntu-latest + environment: + name: mainnet + steps: + - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." + - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!" + - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + - name: restart homepage + uses: appleboy/ssh-action@v0.1.6 + with: + host: ${{ secrets.REMOTE_HOST }} + username: ${{ secrets.REMOTE_USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + script: | + cd /home/${{ secrets.REMOTE_USER }}/bworks_2.0_deploy/docker-configs + docker-compose -f docker-compose.yml stop homepage + docker-compose -f docker-compose.yml rm -f homepage + cat docker-compose.template.yml > docker-compose.yml + sed -i "s|BWORKS_HOMEPAGE_TAG|${{ vars.BWORKS_HOMEPAGE_TAG }}|g" docker-compose.yml + #docker rmi -f 121427815363.dkr.ecr.ap-southeast-1.amazonaws.com/bworks:frontend-testnet + #docker rmi -f jackchuong/itl:bworks-frontend-testnet + aws ecr get-login-password --region ap-southeast-1 | docker login --username AWS --password-stdin 121427815363.dkr.ecr.ap-southeast-1.amazonaws.com/bworks + docker-compose -f docker-compose.yml up -d homepage + - run: echo "🍏 This job's status is ${{ job.status }}." diff --git a/docker-configs/docker-compose.template.yml b/docker-configs/docker-compose.template.yml index ddf148b..7876afb 100644 --- a/docker-configs/docker-compose.template.yml +++ b/docker-configs/docker-compose.template.yml @@ -46,7 +46,8 @@ services: - bworksnet homepage: - image: jackchuong/itl:bworks-homepage-rundirect + #image: jackchuong/itl:bworks-homepage-rundirect + image: BWORKS_HOMEPAGE_TAG container_name: homepage restart: always #ports: