feat: add optional app version input to Windows desktop client build workflow with dynamic artifact naming

Add app_version workflow_dispatch input for specifying custom version during manual builds. Implement version application step that validates input format and updates package.json, tauri.conf.json, and Cargo.toml with requested version string.

Add artifact name suffix based on provided version to distinguish versioned build outputs. Append version to NexaVPN-windows-installer and NexaVPN-windows
This commit is contained in:
2026-03-24 18:58:22 +01:00
parent 3aca2ca55a
commit b4b3494e17

View File

@@ -2,6 +2,11 @@ name: Build Windows Desktop Client
on:
workflow_dispatch:
inputs:
app_version:
description: "Optional app version for this build, e.g. 0.1.3"
required: false
default: ""
jobs:
build-windows-client:
@@ -55,6 +60,42 @@ jobs:
- name: Install desktop client dependencies
run: npm install
- name: Apply requested app version
if: ${{ github.event.inputs.app_version != '' }}
run: |
set -euo pipefail
VERSION="${{ github.event.inputs.app_version }}"
export VERSION
case "${VERSION}" in
*[!0-9A-Za-z.+-]*|'')
echo "Invalid app_version: ${VERSION}"
exit 1
;;
esac
node -e '
const fs = require("fs");
const version = process.env.VERSION;
const pkgPath = "package.json";
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
pkg.version = version;
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
'
node -e '
const fs = require("fs");
const version = process.env.VERSION;
const configPath = "src-tauri/tauri.conf.json";
const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
config.version = version;
fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
'
perl -0pi -e 's/^version = ".*?"$/version = "'"${VERSION}"'"/m' src-tauri/Cargo.toml
echo "Using app version ${VERSION}"
- name: Build bundled Windows tunnel helper
run: npm run helper:windows-x64
@@ -85,6 +126,16 @@ jobs:
- name: Build Windows installer
run: npm run tauri:build:windows-x64:linux
- name: Prepare artifact names
run: |
set -euo pipefail
VERSION="${{ github.event.inputs.app_version }}"
if [ -n "${VERSION}" ]; then
echo "ARTIFACT_SUFFIX=-${VERSION}" >> "${GITHUB_ENV}"
else
echo "ARTIFACT_SUFFIX=" >> "${GITHUB_ENV}"
fi
- name: Sign Windows desktop executable and installer
if: ${{ secrets.WINDOWS_SIGN_PFX_B64 != '' && secrets.WINDOWS_SIGN_PFX_PASSWORD != '' }}
run: |
@@ -121,7 +172,7 @@ jobs:
- name: Upload Windows installer
uses: christopherhx/gitea-upload-artifact@v4
with:
name: NexaVPN-windows-installer
name: NexaVPN-windows-installer${{ env.ARTIFACT_SUFFIX }}
path: |
desktop-client/src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe
desktop-client/src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/*.msi
@@ -130,7 +181,7 @@ jobs:
- name: Upload raw Windows build outputs
uses: christopherhx/gitea-upload-artifact@v4
with:
name: NexaVPN-windows-raw-build
name: NexaVPN-windows-raw-build${{ env.ARTIFACT_SUFFIX }}
path: |
desktop-client/src-tauri/target/x86_64-pc-windows-msvc/release/nexavpn-desktop.exe
desktop-client/src-tauri/bundled/windows-x64/nexavpn-tunnel-helper.exe