|
| 1 | +name: Test, Publish, & Release |
| 2 | +on: [push] |
| 3 | +jobs: |
| 4 | + publish: |
| 5 | + runs-on: ubuntu-latest |
| 6 | + if: startsWith(github.ref, 'refs/tags/') |
| 7 | + steps: |
| 8 | + - name: Set up QEMU |
| 9 | + uses: docker/setup-qemu-action@v1 |
| 10 | + - name: Set up Docker Buildx |
| 11 | + uses: docker/setup-buildx-action@v1 |
| 12 | + - name: Login to DockerHub |
| 13 | + uses: docker/login-action@v1 |
| 14 | + with: |
| 15 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 16 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 17 | + - name: Build and push |
| 18 | + id: docker_build |
| 19 | + uses: docker/build-push-action@v2 |
| 20 | + with: |
| 21 | + push: true |
| 22 | + tags: | |
| 23 | + 4petsocial/landing-page:latest |
| 24 | + 4petsocial/landing-page:0.7.0 |
| 25 | + - name: Image digest |
| 26 | + run: echo ${{ steps.docker_build.outputs.digest }} |
| 27 | + create-release: |
| 28 | + needs: publish |
| 29 | + runs-on: ubuntu-latest |
| 30 | + if: startsWith(github.ref, 'refs/tags/') |
| 31 | + steps: |
| 32 | + - uses: actions/checkout@master |
| 33 | + - uses: Roang-zero1/github-create-release-action@master |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 36 | + deployment: |
| 37 | + needs: publish |
| 38 | + runs-on: ubuntu-latest |
| 39 | + if: startsWith(github.ref, 'refs/tags/') |
| 40 | + steps: |
| 41 | + - name: executing remote ssh commands using password |
| 42 | + uses: appleboy/ssh-action@master |
| 43 | + with: |
| 44 | + host: ${{ secrets.HOST }} |
| 45 | + username: ${{ secrets.USERNAME }} |
| 46 | + key: ${{ secrets.KEY }} |
| 47 | + port: ${{ secrets.PORT }} |
| 48 | + script: cd deployment/prod-env && docker-compose pull && ./scripts/rebuild.sh |
0 commit comments