Skip to content

Commit 7bc4972

Browse files
committed
Fix
1 parent 636f8ea commit 7bc4972

1 file changed

Lines changed: 8 additions & 16 deletions

File tree

.github/workflows/docker-publish.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -68,26 +68,18 @@ jobs:
6868
with:
6969
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
7070

71-
# Build and push Docker image with Buildx (don't push on PR)
72-
# https://github.com/docker/build-push-action
73-
- name: Build and push Docker image
71+
- name: Get the tag name
7472
if: startsWith(github.ref, 'refs/tags/')
75-
id: build-and-push-release
76-
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
77-
with:
78-
context: .
79-
push: ${{ github.event_name != 'pull_request' }}
80-
tags: ${{ steps.meta.outputs.tags }}
81-
labels: ${{ steps.meta.outputs.labels }}
82-
cache-from: type=gha
83-
cache-to: type=gha,mode=max
84-
build-args: BUILD_VERSION=${{ env.TAG }}
73+
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
74+
75+
- name: Get the rev short sha
76+
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
77+
run: echo TAG=$(git rev-parse --short "$GITHUB_SHA") >> $GITHUB_ENV
8578

8679
# Build and push Docker image with Buildx (don't push on PR)
8780
# https://github.com/docker/build-push-action
8881
- name: Build and push Docker image
89-
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
90-
id: build-and-push
82+
id: build-and-push-release
9183
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
9284
with:
9385
context: .
@@ -96,7 +88,7 @@ jobs:
9688
labels: ${{ steps.meta.outputs.labels }}
9789
cache-from: type=gha
9890
cache-to: type=gha,mode=max
99-
build-args: BUILD_VERSION=${{ git rev-parse --short "$GITHUB_SHA" }}
91+
build-args: BUILD_VERSION=${{ env.TAG }}
10092

10193

10294
# # Sign the resulting Docker image digest except on PRs.

0 commit comments

Comments
 (0)