Skip to content

Commit d6d0535

Browse files
committed
chore: implement dynamic version bumping and configure updater public key via environment variable
1 parent f5ba5aa commit d6d0535

5 files changed

Lines changed: 21 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ jobs:
6868
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6969
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
7070
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
71+
TAURI_UPDATER_PUBKEY: ${{ secrets.TAURI_UPDATER_PUBKEY }}
7172
with:
7273
projectPath: ./tauri-app
7374
tagName: ${{ github.ref_name }}

tauri-app/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
{
22
"name": "tauri-app",
33
"private": true,
4-
"version": "0.1.0",
4+
"version": "0.2.0",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
88
"build": "tsc && vite build",
99
"preview": "vite preview",
1010
"tauri": "tauri",
11-
"release": "node scripts/release.js"
11+
"release": "node scripts/release.js minor",
12+
"release:bugfix": "node scripts/release.js bugfix",
13+
"release:major": "node scripts/release.js major"
1214
},
1315
"dependencies": {
1416
"@tailwindcss/vite": "^4.2.2",
@@ -40,4 +42,4 @@
4042
"typescript": "~5.8.3",
4143
"vite": "^7.0.4"
4244
}
43-
}
45+
}

tauri-app/scripts/release.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,25 @@ try {
1818

1919
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
2020

21-
// 2. Increment minor version
21+
// 2. Increment version based on argument
22+
const bumpType = process.argv[2] || 'minor';
2223
const parts = pkg.version.split('.');
2324
if (parts.length !== 3) {
2425
console.error('Error: package.version is not in valid semver format (x.y.z)');
2526
process.exit(1);
2627
}
2728

28-
parts[1] = parseInt(parts[1], 10) + 1;
29-
parts[2] = 0; // reset patch
29+
if (bumpType === 'major') {
30+
parts[0] = parseInt(parts[0], 10) + 1;
31+
parts[1] = 0;
32+
parts[2] = 0;
33+
} else if (bumpType === 'patch' || bumpType === 'bugfix') {
34+
parts[2] = parseInt(parts[2], 10) + 1;
35+
} else {
36+
// default to minor
37+
parts[1] = parseInt(parts[1], 10) + 1;
38+
parts[2] = 0;
39+
}
3040
const newVersion = parts.join('.');
3141
console.log(`Bumping version from ${pkg.version} to ${newVersion}...`);
3242

tauri-app/src-tauri/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async fn proxy_request(
8484
#[cfg_attr(mobile, tauri::mobile_entry_point)]
8585
pub fn run() {
8686
tauri::Builder::default()
87-
.plugin(tauri_plugin_updater::Builder::new().build())
87+
.plugin(tauri_plugin_updater::Builder::new().pubkey(env!("TAURI_UPDATER_PUBKEY")).build())
8888
.plugin(tauri_plugin_opener::init())
8989
.plugin(tauri_plugin_shell::init())
9090
.invoke_handler(tauri::generate_handler![proxy_fetch, proxy_request])

tauri-app/src-tauri/tauri.conf.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,13 @@
4949
"height": 400
5050
}
5151
}
52-
}
5352
}
5453
},
5554
"plugins": {
5655
"updater": {
5756
"endpoints": [
5857
"https://github.com/patch_shifter/daisy-invidious/releases/latest/download/latest.json"
59-
],
60-
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDgwNDc3ODhCQUVFMjgzRgpSV1EvS082NmlIY0VDTUV6OTlmTDcxT0JQWVdtUStoNTMwZ2d4R1JjVmVSWjFBZmI0aVhnRTFSdwo="
58+
]
6159
}
6260
}
6361
}

0 commit comments

Comments
 (0)