Skip to content

Commit 3ecdb29

Browse files
Fix determining BeeGFS version
If multiple tags pointed to the same commit, the version may not be set correctly. Always use the tag pushed to GitHub as the version to avoid issues.
1 parent 77e0790 commit 3ecdb29

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

.github/workflows/build-publish.yaml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ name: "Build and Publish"
33
on:
44
workflow_dispatch:
55
push:
6+
# The ${{ github.ref_name }} is used as the BeeGFS version so this workflow should only be
7+
# triggered by pushing tags that match the BeeGFS semantic versioning scheme.
68
tags:
79
- "[0-9].[0-9].[0-9]"
8-
pull_request:
9-
branches:
10-
- "main"
1110

1211
env:
1312
REGISTRY: ghcr.io
1413
NAMESPACE: thinkparq
15-
DOCKER_BUILDX_BUILD_PLATFORMS: "linux/amd64,linux/arm64"
14+
DOCKER_BUILDX_BUILD_PLATFORMS: "linux/amd64,linux/arm64"
1615

1716
jobs:
1817
publish-images:
@@ -29,13 +28,13 @@ jobs:
2928
packages: write
3029
contents: read
3130
steps:
32-
- uses: actions/checkout@v3
31+
- uses: actions/checkout@v4
3332
with:
3433
fetch-tags: true
3534
fetch-depth: 0
3635

3736
- name: Set up Docker Buildx
38-
uses: docker/setup-buildx-action@v3
37+
uses: docker/setup-buildx-action@v3
3938

4039
- name: Log in to the GitHub Container Registry
4140
uses: docker/login-action@v3
@@ -47,13 +46,7 @@ jobs:
4746
- name: Install Cosign
4847
uses: sigstore/[email protected]
4948
with:
50-
cosign-release: "v2.1.1"
51-
52-
- name: Determine what version of BeeGFS to build images for based on the last tag
53-
id: determine_beegfs_version
54-
run: |
55-
last_version=$(git describe --tags --abbrev=0)
56-
echo "LAST_VERSION=$last_version" >> $GITHUB_OUTPUT
49+
cosign-release: "v2.1.1"
5750

5851
- name: Determine metadata for BeeGFS image
5952
id: meta
@@ -83,7 +76,7 @@ jobs:
8376
# Reference: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#adding-a-description-to-multi-arch-images
8477
outputs: type=image,name=target,annotation-index.org.opencontainers.image.description=Container images for the BeeGFS server services allowing fully containerized BeeGFS deployments
8578
build-args: |
86-
BEEGFS_VERSION=${{ steps.determine_beegfs_version.outputs.LAST_VERSION }}
79+
BEEGFS_VERSION=${{ github.ref_name }}
8780
target: ${{ matrix.image_name }}
8881

8982
# Adapted from:

0 commit comments

Comments
 (0)