Skip to content

Commit 316cc24

Browse files
committed
#147 version fix
1 parent 74b3241 commit 316cc24

2 files changed

Lines changed: 20 additions & 17 deletions

File tree

.github/workflows/cd-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
tags:
66
- "v[0-9]+.[0-9]+.[0-9]+"
7+
- "v[0-9]+.[0-9]+.[0-9]+-preview.*"
78

89
jobs:
910
build:

run_release.ps1

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,47 @@
22
param(
33
[Parameter(Mandatory = $true, HelpMessage = "Provide the version number in the format 'X.Y.Z', e.g., '3.0.0'.")]
44
[string]$VersionNumber,
5+
56
[Parameter(Mandatory = $true)]
67
[bool]$IsPreview
78
)
89

9-
# Validate the input format
10+
# Validate version number format X.Y.Z
1011
if ($VersionNumber -notmatch '^\d+\.\d+\.\d+$') {
11-
Write-Host "Error: Version number must be in the format 'X.Y.Z', e.g., '3.0.0'." -ForegroundColor Red
12+
Write-Host "Error: Version number must be in the format 'X.Y.Z', e.g., '3.0.0'." -ForegroundColor Red
1213
exit 1
1314
}
1415

15-
# Generate PreviewVersion dynamically
16-
$Timestamp = (Get-Date -Format "ddMMyy")
17-
$Time = (Get-Date -Format "HHmm")
18-
$PreviewVersion = "$Timestamp.$Time"
16+
# Build preview suffix (valid SemVer identifiers, no leading zeros)
17+
$DatePart = (Get-Date -Format "yyyyMMdd") # e.g. 20250822
18+
$TimePart = (Get-Date -Format "Hmm") # e.g. 845 (not 0845, no leading zero!)
19+
$PreviewId = "$DatePart.$TimePart" # → "20250822.845"
1920

20-
# Construct the tag and message dynamically
21+
# Construct the tag
2122
if ($IsPreview) {
22-
$TagName = "v$VersionNumber-preview$PreviewVersion"
23+
# format: vX.Y.Z-preview.YYYYMMDD.HHmm
24+
$TagName = "v$VersionNumber-preview.$PreviewId"
2325
} else {
2426
$TagName = "v$VersionNumber"
2527
}
2628
$Message = "Release version $TagName"
2729

28-
# Display confirmation prompt
29-
Write-Host "You are about to release:" -ForegroundColor Yellow
30-
Write-Host "Tag: $TagName" -ForegroundColor Cyan
31-
Write-Host "Message: $Message" -ForegroundColor Cyan
30+
# Confirm with user
31+
Write-Host "🚀 You are about to release:" -ForegroundColor Yellow
32+
Write-Host " Tag: $TagName" -ForegroundColor Cyan
33+
Write-Host " Message: $Message" -ForegroundColor Cyan
3234
$response = Read-Host "Are you sure you want to proceed? (yes/no)"
3335

3436
if ($response -ne "yes") {
35-
Write-Host "Release canceled by the user." -ForegroundColor Red
37+
Write-Host "Release canceled by the user." -ForegroundColor Red
3638
exit 0
3739
}
3840

39-
# Execute the git commands
40-
Write-Host "Creating tag $TagName with message: $Message"
41+
# Git commands
42+
Write-Host "🔖 Creating tag $TagName with message: $Message"
4143
git tag -a $TagName -m $Message
4244

43-
Write-Host "Pushing tag $TagName to origin"
45+
Write-Host "⬆️ Pushing tag $TagName to origin"
4446
git push origin $TagName
4547

46-
Write-Host "Tag $TagName pushed successfully." -ForegroundColor Green
48+
Write-Host "Tag $TagName pushed successfully." -ForegroundColor Green

0 commit comments

Comments
 (0)