From be3025cfbb2ffd793332fb7f0875631769ee94a8 Mon Sep 17 00:00:00 2001 From: allburov Date: Sun, 14 Aug 2022 09:04:09 +0300 Subject: [PATCH] Add docker build and push github action --- .github/workflows/build.yaml | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..96f6c20d --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,40 @@ +name: Release + +on: + push: + tags: + - "*" + +jobs: + deploy-docker: + runs-on: ubuntu-latest + + needs: deploy-pypi + steps: + - uses: actions/checkout@v2 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: allburov/whatsapp-http-api + flavor: latest=true + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + - name: Login to image repository + if: github.ref_type == 'tag' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile + push: ${{ github.ref_type == 'tag' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}