mirror of
https://github.com/jpawlowski/hass.tibber_prices.git
synced 2026-03-29 21:03:40 +00:00
chore(release): enhance version parsing to support beta/prerelease suffix
This commit is contained in:
parent
3157c6f0df
commit
3968dba9d2
2 changed files with 17 additions and 7 deletions
6
.github/workflows/auto-tag.yml
vendored
6
.github/workflows/auto-tag.yml
vendored
|
|
@ -43,13 +43,13 @@ jobs:
|
|||
echo "✗ Tag v${{ steps.manifest.outputs.version }} does not exist yet"
|
||||
fi
|
||||
|
||||
- name: Validate version format
|
||||
- name: Validate version format (stable or beta)
|
||||
if: steps.tag_check.outputs.exists == 'false'
|
||||
run: |
|
||||
VERSION="${{ steps.manifest.outputs.version }}"
|
||||
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
|
||||
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(b[0-9]+)?$'; then
|
||||
echo "❌ Invalid version format: $VERSION"
|
||||
echo "Expected format: X.Y.Z (e.g., 1.0.0)"
|
||||
echo "Expected format: X.Y.Z or X.Y.ZbN (e.g., 1.0.0, 0.25.0b0)"
|
||||
exit 1
|
||||
fi
|
||||
echo "✓ Version format valid: $VERSION"
|
||||
|
|
|
|||
18
.github/workflows/release.yml
vendored
18
.github/workflows/release.yml
vendored
|
|
@ -135,10 +135,20 @@ jobs:
|
|||
FEAT=$(echo "$COMMITS" | grep -cE "^feat(\(.+\))?:" || true)
|
||||
FIX=$(echo "$COMMITS" | grep -cE "^fix(\(.+\))?:" || true)
|
||||
|
||||
# Parse versions
|
||||
parse_version() {
|
||||
local version="$1"
|
||||
if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(b[0-9]+)?$ ]]; then
|
||||
echo "${BASH_REMATCH[1]} ${BASH_REMATCH[2]} ${BASH_REMATCH[3]} ${BASH_REMATCH[4]}"
|
||||
else
|
||||
echo "Invalid version format: $version" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Parse versions (support beta/prerelease suffix like 0.25.0b0)
|
||||
PREV_VERSION="${PREV_TAG#v}"
|
||||
IFS='.' read -r PREV_MAJOR PREV_MINOR PREV_PATCH <<< "$PREV_VERSION"
|
||||
IFS='.' read -r MAJOR MINOR PATCH <<< "$TAG_VERSION"
|
||||
read -r PREV_MAJOR PREV_MINOR PREV_PATCH PREV_PRERELEASE <<< "$(parse_version "$PREV_VERSION")"
|
||||
read -r MAJOR MINOR PATCH PRERELEASE <<< "$(parse_version "$TAG_VERSION")"
|
||||
|
||||
WARNING=""
|
||||
SUGGESTION=""
|
||||
|
|
@ -245,7 +255,7 @@ jobs:
|
|||
name: ${{ steps.release_notes.outputs.title }}
|
||||
body: ${{ steps.release_notes.outputs.notes }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
prerelease: ${{ contains(github.ref, 'b') }}
|
||||
generate_release_notes: false # We provide our own
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
|||
Loading…
Reference in a new issue