mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
fix(ci): sync version from git tag to Tauri build artifacts
Tauri desktop artifacts were always named with hardcoded version 0.1.0 (from tauri.conf.json) instead of the actual release version. Extract the version from the git tag and update tauri.conf.json and Cargo.toml before building.
This commit is contained in:
@@ -35,6 +35,35 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Extract version from tag
|
||||||
|
id: version
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
TAG="${GITHUB_REF_NAME}"
|
||||||
|
VERSION="${TAG#v}"
|
||||||
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Resolved version: $VERSION"
|
||||||
|
|
||||||
|
- name: Sync version to tauri.conf.json and Cargo.toml
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
VERSION="${{ steps.version.outputs.version }}"
|
||||||
|
TAURI_CONF="apps/desktop/src-tauri/tauri.conf.json"
|
||||||
|
CARGO_TOML="apps/desktop/src-tauri/Cargo.toml"
|
||||||
|
|
||||||
|
node -e "
|
||||||
|
const fs = require('fs');
|
||||||
|
const conf = JSON.parse(fs.readFileSync('$TAURI_CONF', 'utf8'));
|
||||||
|
conf.version = '$VERSION';
|
||||||
|
fs.writeFileSync('$TAURI_CONF', JSON.stringify(conf, null, 2) + '\n');
|
||||||
|
"
|
||||||
|
|
||||||
|
sed -i.bak "s/^version = \".*\"/version = \"$VERSION\"/" "$CARGO_TOML"
|
||||||
|
rm -f "$CARGO_TOML.bak"
|
||||||
|
|
||||||
|
echo "Updated $TAURI_CONF version to $VERSION"
|
||||||
|
echo "Updated $CARGO_TOML version to $VERSION"
|
||||||
|
|
||||||
- uses: pnpm/action-setup@v4
|
- uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 10
|
version: 10
|
||||||
|
|||||||
Reference in New Issue
Block a user