fix(build): correct version output handling in workflow to ensure proper version assignment and validation

This commit is contained in:
2026-01-01 19:28:58 -06:00
parent ce25fc0c73
commit f9605436c4

View File

@@ -33,22 +33,22 @@ jobs:
- name: Determine version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION="${GITHUB_REF#refs/tags/}"
if [ -z "${VERSION}" ]; then
VERSION="${{ github.ref_name }}"
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.version }}" ]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION="${GITHUB_REF#refs/tags/}"
if [ -z "${VERSION}" ]; then
VERSION="${{ github.ref_name }}"
fi
if [ "${VERSION}" = "master" ] || [ "${VERSION}" = "main" ]; then
echo "Error: Invalid tag name '${VERSION}'. Tag name cannot be a branch name." >&2
exit 1
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
else
SHORT_SHA=$(git rev-parse --short HEAD)
echo "version=${SHORT_SHA}" >> $GITHUB_OUTPUT
fi
if [ "${VERSION}" = "master" ] || [ "${VERSION}" = "main" ]; then
echo "Error: Invalid tag name '${VERSION}'. Tag name cannot be a branch name." >&2
exit 1
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
else
SHORT_SHA=$(git rev-parse --short HEAD)
echo "version=${SHORT_SHA}" >> $GITHUB_OUTPUT
fi
- name: Install NodeJS
uses: https://git.quad4.io/actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
@@ -74,7 +74,7 @@ jobs:
- name: Setup Task
uses: https://git.quad4.io/actions/setup-task@0ab1b2a65bc55236a3bc64cde78f80e20e8885c2 # v1
with:
version: '3.46.3'
version: "3.46.3"
- name: Sync versions
run: python scripts/sync_version.py
@@ -100,7 +100,7 @@ jobs:
# Collect artifacts
find dist -type f \( -name "*-linux*.AppImage" -o -name "*-linux*.deb" \) -exec cp {} release-assets/ \;
find python-dist -type f -name "*.whl" -exec cp {} release-assets/ \;
# Generate checksums
cd release-assets
echo "## SHA256 Checksums" > release-body.md
@@ -114,16 +114,16 @@ jobs:
- name: Validate version
run: |
VERSION="${{ steps.version.outputs.version }}"
if [ -z "${VERSION}" ]; then
echo "Error: Version is empty" >&2
exit 1
fi
if [ "${VERSION}" = "master" ] || [ "${VERSION}" = "main" ]; then
echo "Error: Invalid version '${VERSION}'. Version cannot be a branch name." >&2
exit 1
fi
echo "Using version: ${VERSION}"
VERSION="${{ steps.version.outputs.version }}"
if [ -z "${VERSION}" ]; then
echo "Error: Version is empty" >&2
exit 1
fi
if [ "${VERSION}" = "master" ] || [ "${VERSION}" = "main" ]; then
echo "Error: Invalid version '${VERSION}'. Version cannot be a branch name." >&2
exit 1
fi
echo "Using version: ${VERSION}"
- name: Create Release
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'