Skip to content

Generate BASE_VERSION #56

@bh2smith

Description

@bh2smith

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions