Skip to content

Commit 7d64154

Browse files
authored
Update versioning to use 'bt' prefix for tags
1 parent 376d291 commit 7d64154

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

.github/workflows/publishbusestracing.yml

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ on:
1010
description: "Build configuration (Release/Debug)"
1111
required: false
1212
default: "Release"
13-
1413
jobs:
1514
# 1) Compute next version once. Tag happens in the release job.
1615
versioning:
@@ -19,41 +18,28 @@ jobs:
1918
next_version: ${{ steps.version.outputs.next_version }}
2019
steps:
2120
- name: Checkout repository
22-
uses: actions/checkout@v4
23-
24-
- name: Fetch tags
25-
run: git fetch --tags
26-
27-
- name: Debug tags
28-
shell: pwsh
29-
run: |
30-
git --version
31-
git rev-parse --is-inside-work-tree
32-
try {
33-
git tag --list 2>$null | Sort-Object
34-
} catch {
35-
Write-Warning "Unable to list tags: $_"
36-
} finally {
37-
$global:LASTEXITCODE = 0
38-
}
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0 # full history
24+
fetch-tags: true # also fetch tags
3925

4026
- name: Calculate next version
4127
id: version
4228
shell: pwsh
4329
run: |
4430
$latestTag = ''
4531
try {
46-
$latestTag = (git describe --tags --abbrev=0 2>$null) -replace "`r?`n",""
32+
$latestTag = (git describe --tags --abbrev=0 --match "bt[0-9]*.[0-9]*.[0-9]*")
4733
} catch {
4834
$latestTag = ''
4935
} finally {
5036
$global:LASTEXITCODE = 0
5137
}
52-
38+
5339
if ([string]::IsNullOrEmpty($latestTag)) {
5440
$major = 1; $minor = 0; $patch = 0
5541
} else {
56-
$version = $latestTag.TrimStart('v')
42+
$version = $latestTag.TrimStart('bt')
5743
$parts = $version.Split('.')
5844
$major = [int]$parts[0]; $minor = [int]$parts[1]; $patch = [int]$parts[2]
5945
$bump = "${{ github.event.inputs.version }}"
@@ -154,6 +140,8 @@ jobs:
154140
release:
155141
needs: [versioning, build]
156142
runs-on: windows-latest
143+
permissions:
144+
contents: write
157145
steps:
158146
- name: Checkout repository
159147
uses: actions/checkout@v4
@@ -169,7 +157,7 @@ jobs:
169157
git config user.name "github-actions[bot]"
170158
git config user.email "github-actions[bot]@users.noreply.github.com"
171159
git fetch --tags
172-
$tag = "v${{ needs.versioning.outputs.next_version }}"
160+
$tag = "bt${{ needs.versioning.outputs.next_version }}"
173161
# Only create if it doesn't exist
174162
$existing = (git tag --list $tag)
175163
if (-not $existing) {
@@ -182,7 +170,7 @@ jobs:
182170
- name: Create GitHub Release
183171
uses: softprops/action-gh-release@v1
184172
with:
185-
tag_name: v${{ needs.versioning.outputs.next_version }}
173+
tag_name: bt${{ needs.versioning.outputs.next_version }}
186174
name: "Buses Tracing Tools (winget) v${{ needs.versioning.outputs.next_version }}"
187175
files: |
188176
release/zips-win-x64/busestracing-win-x64.zip

0 commit comments

Comments
 (0)