Skip to content

Commit 2b73e1a

Browse files
committed
release v1.0.8
1 parent 76e6802 commit 2b73e1a

7 files changed

Lines changed: 375 additions & 96 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "tauri-app",
33
"private": true,
4-
"version": "1.0.7",
4+
"version": "1.0.8",
55
"homepage": "https://holdon1996.github.io/dev-stack/",
66
"type": "module",
77
"scripts": {

scripts/bump-version.ps1

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
param(
2-
[Parameter(Mandatory = $true)]
32
[string]$Version
43
)
54

65
$semverPattern = '^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$'
7-
if ($Version -notmatch $semverPattern) {
8-
throw "Invalid version '$Version'. Expected semver like 1.0.1 or 1.1.0-beta.1"
9-
}
106

117
$repoRoot = Split-Path -Parent $PSScriptRoot
128
$packageJsonPath = Join-Path $repoRoot 'package.json'
@@ -17,6 +13,48 @@ if (-not (Test-Path -LiteralPath $packageJsonPath)) { throw "Missing file: $pack
1713
if (-not (Test-Path -LiteralPath $cargoTomlPath)) { throw "Missing file: $cargoTomlPath" }
1814
if (-not (Test-Path -LiteralPath $tauriConfPath)) { throw "Missing file: $tauriConfPath" }
1915

16+
function Get-PackageVersion {
17+
param(
18+
[Parameter(Mandatory = $true)]
19+
[string]$Path
20+
)
21+
22+
$packageJson = Get-Content -LiteralPath $Path -Raw
23+
$match = [regex]::Match($packageJson, '(?m)^\s*"version"\s*:\s*"([^"]+)"')
24+
if (-not $match.Success) {
25+
throw "Could not find version field in $Path"
26+
}
27+
28+
return $match.Groups[1].Value
29+
}
30+
31+
function Get-NextPatchVersion {
32+
param(
33+
[Parameter(Mandatory = $true)]
34+
[string]$CurrentVersion
35+
)
36+
37+
$match = [regex]::Match($CurrentVersion, '^(\d+)\.(\d+)\.(\d+)')
38+
if (-not $match.Success) {
39+
throw "Cannot auto-bump non-semver version '$CurrentVersion'. Pass -Version explicitly."
40+
}
41+
42+
$major = [int]$match.Groups[1].Value
43+
$minor = [int]$match.Groups[2].Value
44+
$patch = [int]$match.Groups[3].Value + 1
45+
return "$major.$minor.$patch"
46+
}
47+
48+
if ([string]::IsNullOrWhiteSpace($Version)) {
49+
$currentVersion = Get-PackageVersion -Path $packageJsonPath
50+
$Version = Get-NextPatchVersion -CurrentVersion $currentVersion
51+
Write-Host "Auto-bumped version: $currentVersion -> $Version" -ForegroundColor Cyan
52+
}
53+
54+
if ($Version -notmatch $semverPattern) {
55+
throw "Invalid version '$Version'. Expected semver like 1.0.1 or 1.1.0-beta.1"
56+
}
57+
2058
$packageJson = Get-Content -LiteralPath $packageJsonPath -Raw
2159
$packageJsonRegex = [regex]'(?m)^(\s*"version"\s*:\s*")[^"]+(")'
2260
$packageJson = $packageJsonRegex.Replace(

scripts/release-version.ps1

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
param(
2-
[Parameter(Mandatory = $true)]
32
[string]$Version,
43
[string]$Branch = "main",
54
[string]$Remote = "origin",
@@ -25,7 +24,25 @@ function Get-GitChanges {
2524
})
2625
}
2726

28-
& (Join-Path $PSScriptRoot 'bump-version.ps1') -Version $Version
27+
function Get-PackageVersion {
28+
param(
29+
[Parameter(Mandatory = $true)]
30+
[string]$Path
31+
)
32+
33+
$packageJson = Get-Content -LiteralPath $Path -Raw
34+
$match = [regex]::Match($packageJson, '(?m)^\s*"version"\s*:\s*"([^"]+)"')
35+
if (-not $match.Success) {
36+
throw "Could not find version field in $Path"
37+
}
38+
39+
return $match.Groups[1].Value
40+
}
41+
42+
$bumpArgs = @{}
43+
if (-not [string]::IsNullOrWhiteSpace($Version)) {
44+
$bumpArgs.Version = $Version
45+
}
2946

3047
$changes = Get-GitChanges
3148
$extraChanges = @($changes | Where-Object { $_ -notin $allowedVersionFiles })
@@ -36,6 +53,10 @@ if (-not $StageAll -and $extraChanges.Count -gt 0) {
3653
throw "Refusing to create a release commit with unrelated changes. Commit them first or rerun with -StageAll."
3754
}
3855

56+
& (Join-Path $PSScriptRoot 'bump-version.ps1') @bumpArgs
57+
58+
$Version = Get-PackageVersion -Path (Join-Path $repoRoot 'package.json')
59+
3960
if ($StageAll) {
4061
git add -A
4162
} else {

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "tauri-app"
3-
version = "1.0.7"
3+
version = "1.0.8"
44
description = "A Tauri App"
55
authors = ["you"]
66
edition = "2021"

0 commit comments

Comments
 (0)