From 9ac503903b25448052e07a66156519334417bec2 Mon Sep 17 00:00:00 2001 From: apiyo Date: Wed, 14 Dec 2022 09:35:11 +0300 Subject: [PATCH] Build docker image when a tag is pushed --- .github/workflows/docker-image-build.yaml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker-image-build.yaml b/.github/workflows/docker-image-build.yaml index 4956286..079128b 100644 --- a/.github/workflows/docker-image-build.yaml +++ b/.github/workflows/docker-image-build.yaml @@ -1,22 +1,20 @@ name: build and push image to dockerhub on: push: - branches: - - ona-custom-changes - workflow_dispatch: - inputs: - versionTag: - description: "Version Tag" - required: true - default: "" + tags: + - '[0-9]+\.[0-9]+\.[0-9]+' jobs: main: runs-on: ubuntu-22.04 steps: + - name: Get the version + id: get-version-release + run: echo "version=${GITHUB_REF_NAME#refs/heads}" >> $GITHUB_ENV + - name: Checkout to version uses: actions/checkout@v3 with: - ref: ${{ github.event.inputs.versionTag || '0.0.4' }} + ref: ${{ env.version }} - name: Login to DockerHub uses: docker/login-action@v2 @@ -32,7 +30,7 @@ jobs: file: Dockerfile platforms: linux/amd64 tags: | - onaio/dirt-tile-server:${{ github.event.inputs.versionTag || '0.0.4' }} + onaio/dirt-tile-server:${{ env.version }} - name: Image digest run: echo ${{ steps.docker-build.outputs.digest }}