From 258405d19ef7963557312d6f07ea79239af66cbe Mon Sep 17 00:00:00 2001 From: "Alexander 4584443+DragonStuff@users.noreply.github.com" <4584443+DragonStuff@users.noreply.github.com> Date: Sat, 6 Apr 2024 20:41:53 +0900 Subject: [PATCH] feature(ci): push github ref as docker tag --- .github/workflows/ci.yaml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 21d5576..b787a10 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,7 +31,7 @@ jobs: build_and_push: needs: test - if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest steps: @@ -45,9 +45,17 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Docker image tag + id: prep + run: | + TAG=${GITHUB_REF#refs/*/} + echo ::set-output name=tag::${TAG} + - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . push: true - tags: ghcr.io/${{ github.repository_owner }}/ns-object-mirror:latest + tags: | + ghcr.io/${{ github.repository_owner }}/ns-object-mirror:latest + ghcr.io/${{ github.repository_owner }}/ns-object-mirror:${{ github.ref }}