From 74ee61dfbf6589f9d5bd2e314e48f86f0e6f25b1 Mon Sep 17 00:00:00 2001 From: Pablo Castellano Date: Fri, 19 Jan 2024 19:47:24 +0100 Subject: [PATCH] ci: publish on docker hub --- .github/workflows/publish_docker.yaml | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/publish_docker.yaml diff --git a/.github/workflows/publish_docker.yaml b/.github/workflows/publish_docker.yaml new file mode 100644 index 00000000..9ccc256f --- /dev/null +++ b/.github/workflows/publish_docker.yaml @@ -0,0 +1,43 @@ +name: Publish on Docker Hub + +on: + pull_request: + branches: ["*"] + push: + branches: ["master"] + release: + types: [published] + +jobs: + publish: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: pablocastellano/bee-dashboard + tags: | + type=ref,event=branch + type=ref,event=tag + type=semver,pattern={{version}} + type=raw,value=latest,enable=${{ github.ref_name == 'master' }} + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}