File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,16 +22,23 @@ jobs:
2222 uses : actions/setup-dotnet@v5
2323 with :
2424 dotnet-version : 9.0.x
25- - name : Compute version suffix for branch builds
25+ - name : Compute version override for branch builds
2626 if : ${{ !startsWith(github.ref, 'refs/tags/') }}
2727 id : version
2828 run : |
29+ # Latest release tag matching the convention <version>-octopus.<n>
30+ LATEST=$(git tag --list --sort=-v:refname | grep -E '^[0-9]+\.[0-9]+\.[0-9]+-octopus\.[0-9]+$' | head -n 1)
31+ if [ -z "$LATEST" ]; then
32+ echo "::error::No release tag matching <version>-octopus.<n> found"
33+ exit 1
34+ fi
2935 # Sanitize branch name: lowercase, replace non-alphanumeric with hyphen, trim to 20 chars
3036 BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
3137 SAFE_BRANCH=$(echo "$BRANCH" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//' | sed 's/-$//' | cut -c1-20)
32- echo "override=${SAFE_BRANCH}.${{ github.run_number }}" >> "$GITHUB_OUTPUT"
38+ # Join with '.' (not '-') so branch/run land as separate prerelease IDs, keeping ordering correct vs the next octopus.<n+1>
39+ echo "override=${LATEST}.${SAFE_BRANCH}.${{ github.run_number }}" >> "$GITHUB_OUTPUT"
3340 - name : Build
34- run : dotnet build LibGit2Sharp.sln --configuration Release ${{ steps.version.outputs.override && format('/p:MinVerDefaultPreReleaseIdentifiers=" {0}" ', steps.version.outputs.override) || '' }}
41+ run : dotnet build LibGit2Sharp.sln --configuration Release ${{ steps.version.outputs.override && format('/p:MinVerVersionOverride= {0}', steps.version.outputs.override) || '' }}
3542 - name : Upload packages
3643 uses : actions/upload-artifact@v7
3744 with :
You can’t perform that action at this time.
0 commit comments