-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
We currently have a hard coded "Base Version" in the branch-release. This could potentially be automated as follows:
- name: Set Version from Branch
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
BRANCH_NAME=${BRANCH_NAME//\//-} # Replace slashes with dashes
SHORT_SHA=$(git rev-parse --short HEAD)
# Get the latest version tag and increment patch
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
LATEST_VERSION=${LATEST_TAG#v} # Remove 'v' prefix
# Split version into major.minor.patch
IFS='.' read -r major minor patch <<< "$LATEST_VERSION"
# Increment patch version
patch=$((patch + 1))
BASE_VERSION="${major}.${minor}.${patch}"
VERSION="${BASE_VERSION}-${BRANCH_NAME}-${SHORT_SHA}"
pnpm version $VERSION --no-git-tag-version
Generally, I am not fond of these branch releases because they make the version history look ugly and polluted. see here
Metadata
Metadata
Assignees
Labels
No labels