Skip to content

Commit 54bbc7f

Browse files
committed
修复打包时版本不一致问题
1 parent 60e8de5 commit 54bbc7f

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,33 @@ jobs:
9696
restore-keys: |
9797
${{ runner.os }}-cargo-
9898
99+
- name: Extract version from tag
100+
shell: bash
101+
run: |
102+
VERSION=${GITHUB_REF#refs/tags/v}
103+
echo "VERSION=$VERSION" >> $GITHUB_ENV
104+
echo "Extracted version: $VERSION"
105+
106+
- name: Update version in tauri.conf.json
107+
shell: bash
108+
run: |
109+
if [[ "$RUNNER_OS" == "macOS" ]]; then
110+
sed -i '' "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" src-tauri/tauri.conf.json
111+
else
112+
sed -i "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" src-tauri/tauri.conf.json
113+
fi
114+
echo "Updated tauri.conf.json version to: $VERSION"
115+
116+
- name: Update version in Cargo.toml
117+
shell: bash
118+
run: |
119+
if [[ "$RUNNER_OS" == "macOS" ]]; then
120+
sed -i '' "s/^version = \".*\"/version = \"$VERSION\"/" src-tauri/Cargo.toml
121+
else
122+
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" src-tauri/Cargo.toml
123+
fi
124+
echo "Updated Cargo.toml version to: $VERSION"
125+
99126
- name: Build Tauri app
100127
run: pnpm tauri build
101128
env:

0 commit comments

Comments
 (0)