From 7ddb5f75936ef0249bcfb80928ed8fb27dfdd5e9 Mon Sep 17 00:00:00 2001 From: Aarno Aukia Date: Fri, 3 Feb 2023 11:16:26 +0100 Subject: [PATCH] add CD to dockerhub --- .github/workflows/docker-image.yml | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..177e650 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,33 @@ +name: CD to Docker Hub + +on: + push: + branches: [ master ] + tags: [ '*' ] + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v3 + - name: Docker labels & tags metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: vshn/antora + - name: Log in to Docker Hub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + - name: Build and push to Docker Hub + uses: docker/build-push-action@v4 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} # push both tag name and "latest" on new git tag + labels: ${{ steps.meta.outputs.labels }}