Enhance versionning on build packages (#165)
Some checks failed
Go-Tests / sonar (push) Has been cancelled
Go-Tests / tests (push) Has been cancelled

It was too challenging to only use "tags" without a prefix to trigger builds. So, the new rule is to prefix releases tags by "releases/"

Reviewed-on: #165
This commit is contained in:
2025-08-22 08:33:32 +00:00
parent d30690a45a
commit 46f41ea01d
7 changed files with 54 additions and 13 deletions

View File

@@ -15,6 +15,7 @@ env:
LICENSE: MIT
DESCRIPTION: "Effortless conversion from compose files (docker, podman) to Helm Charts"
URL: "https://katenary.io"
VERSION: ${{ gitea.ref_name }}
jobs:
build-packages:
@@ -35,7 +36,8 @@ jobs:
steps:
- name: Extract version
run: |
VERSION="${GITEA_REFNAME#releases/}
VERSION="${VERSION#releases/}"
echo "Exporting variable VERSION=$VERSION"
echo "VERSION=$VERSION" >> $GITEA_OUTPUT
echo "VERSION=$VERSION" >> $GITEA_ENV
@@ -61,6 +63,7 @@ jobs:
- name: Compile binary
if: matrix.goos == 'linux' || matrix.goos == 'freebsd' || matrix.goos == 'darwin'
run: |-
echo "Building binary version $VERSION"
mkdir -p dist
GOARCH=${{ matrix.goarch }} GOOS=${{ matrix.goos }}\
go build -ldflags="-X 'repo.katenary.io/katenary/katenary/internal/generator.Version=$VERSION'" \

View File

@@ -9,6 +9,7 @@ env:
REGISTRY: repo.katenary.io
IMAGE_NAME: ${{ gitea.repository }}
STORAGE_DRIVER: vfs
VERSION: ${{ gitea.ref_name }}
jobs:
build:
@@ -19,7 +20,8 @@ jobs:
steps:
- name: Extract version
run: |
VERSION="${GITEA_REFNAME#releases/}
VERSION="${VERSION#releases/}"
echo "Exporting variable VERSION=$VERSION"
echo "VERSION=$VERSION" >> $GITEA_OUTPUT
echo "VERSION=$VERSION" >> $GITEA_ENV
@@ -42,6 +44,7 @@ jobs:
- name: Build and tag
run: |-
echo "Building image $REGISTRY/${IMAGE_NAME,,}:$VERSION / latest"
buildah build --isolation=chroot --build-arg VERSION=$VERSION -t katenary -f ./oci/katenary/Containerfile .
buildah tag katenary $REGISTRY/${IMAGE_NAME,,}:$VERSION
buildah tag katenary $REGISTRY/${IMAGE_NAME,,}:latest