From 54bb2c73343d94b4f375bde4a2d75280d990e072 Mon Sep 17 00:00:00 2001 From: Thien Vi Chi Date: Wed, 16 Jun 2021 23:43:06 +0700 Subject: [PATCH] add: github action --- .../docker-publish-release-deployment.yml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/docker-publish-release-deployment.yml diff --git a/.github/workflows/docker-publish-release-deployment.yml b/.github/workflows/docker-publish-release-deployment.yml new file mode 100644 index 0000000..5cce89c --- /dev/null +++ b/.github/workflows/docker-publish-release-deployment.yml @@ -0,0 +1,48 @@ +name: Test, Publish, & Release +on: [push] +jobs: + publish: + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: | + 4petsocial/landing-page:latest + 4petsocial/landing-page:0.7.0 + - name: Image digest + run: echo ${{ steps.docker_build.outputs.digest }} + create-release: + needs: publish + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/checkout@master + - uses: Roang-zero1/github-create-release-action@master + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + deployment: + needs: publish + runs-on: ubuntu-latest + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: executing remote ssh commands using password + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + port: ${{ secrets.PORT }} + script: cd deployment/prod-env && docker-compose pull && ./scripts/rebuild.sh