From 6e684cf40e93088131fa1008de52e9f7d33b0127 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 11 Mar 2022 22:27:43 +0500 Subject: workflows/ci: add a deploy job --- .github/workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to '.github/workflows') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f0e1d49..21027df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,3 +21,28 @@ jobs: python-version: '${{ matrix.python-version }}' - name: Run tests run: ./test/test.sh + + deploy: + needs: [test] + runs-on: ubuntu-latest + name: Deploy + if: github.ref == 'refs/heads/master' + env: + DOCKER_HOST: 'tcp://${{ secrets.DEPLOY_DOCKER_HOST }}:${{ secrets.DEPLOY_DOCKER_PORT }}' + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up VPN + uses: egor-tensin/setup-wireguard@v1 + with: + endpoint: '${{ secrets.WG_ENDPOINT }}' + endpoint_public_key: '${{ secrets.WG_ENDPOINT_PUBLIC_KEY }}' + ips: '${{ secrets.WG_IPS }}' + allowed_ips: '${{ secrets.WG_ALLOWED_IPS }}' + private_key: '${{ secrets.WG_PRIVATE_KEY }}' + preshared_key: '${{ secrets.WG_PRESHARED_KEY }}' + - name: Deploy + run: | + docker-compose pull + docker-compose build --pull + docker-compose up -d -- cgit v1.2.3