diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a89b224..f76b456 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,11 +34,16 @@ jobs: images: ${{ matrix.image }} - name: Docker build and push uses: docker/build-push-action@v6 + env: + VERSION: ${{ github.ref_name }}-head + GIT_COMMIT: ${{ github.sha }} with: provenance: false context: . + build-args: | + LINKFLAGS="-X main.AppVersion=${{ env.VERSION }} -X main.GitCommit=${{ env.GIT_COMMIT }}" platforms: linux/amd64,linux/arm64 file: ${{ matrix.dockerfile }} push: true - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ env.VERSION }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/pull-request.yaml b/.github/workflows/pull-request.yaml index d45dcf0..cd3ae56 100644 --- a/.github/workflows/pull-request.yaml +++ b/.github/workflows/pull-request.yaml @@ -40,11 +40,16 @@ jobs: run: make build - name: Docker build uses: docker/build-push-action@v6 + env: + VERSION: ${{ github.event.pull_request.head.ref }}-head + GIT_COMMIT: ${{ github.sha }} with: provenance: false context: . + build-args: | + LINKFLAGS="-X main.AppVersion=${{ env.VERSION }} -X main.GitCommit=${{ env.GIT_COMMIT }}" platforms: linux/amd64,linux/arm64 file: ${{ matrix.dockerfile }} push: false - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ env.VERSION }} labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 6e9d337..9aebe53 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -34,11 +34,16 @@ jobs: images: ${{ matrix.image }} - name: Docker build and push uses: docker/build-push-action@v6 + env: + VERSION: ${{ github.ref_name }} + GIT_COMMIT: ${{ github.sha }} with: provenance: false context: . + build-args: | + LINKFLAGS="-X main.AppVersion=${{ env.VERSION }} -X main.GitCommit=${{ env.GIT_COMMIT }}" platforms: linux/amd64,linux/arm64 file: ${{ matrix.dockerfile }} push: true - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ env.VERSION }} labels: ${{ steps.meta.outputs.labels }}