Skip to content

Commit 56c7a4e

Browse files
authored
fix: use git tag for release version instead of hardcoded config (#14)
The release workflow used tagName: v__VERSION__ which resolved to the version in tauri.conf.json (0.1.0) regardless of the actual tag pushed. This caused artifacts to be uploaded to the wrong release. Changes: - Use ${{ github.ref_name }} for tagName/releaseName so the release matches the pushed tag - Add version-sync step to update tauri.conf.json and Cargo.toml from the git tag before building, so binary version matches the release - Guard TAURI_SIGNING_PRIVATE_KEY with || '' to prevent build failures when the secret is unset
1 parent 2c7557a commit 56c7a4e

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

.github/workflows/release.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ jobs:
3333
steps:
3434
- uses: actions/checkout@v4
3535

36+
- name: Sync version from git tag
37+
shell: bash
38+
run: |
39+
# Extract version from tag (strip leading 'v')
40+
VERSION="${GITHUB_REF_NAME#v}"
41+
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
42+
# Update tauri.conf.json
43+
cd src-tauri
44+
sed -i.bak 's/"version": "[^"]*"/"version": "'"$VERSION"'"/' tauri.conf.json && rm -f tauri.conf.json.bak
45+
# Update Cargo.toml (only the first version = line, i.e. the package version)
46+
sed -i.bak '0,/^version = ".*"/s//version = "'"$VERSION"'"/' Cargo.toml && rm -f Cargo.toml.bak
47+
echo "Set version to $VERSION"
48+
3649
- uses: actions/setup-node@v4
3750
with:
3851
node-version: "20"
@@ -100,12 +113,12 @@ jobs:
100113
EV_KEY: ${{ vars.EV_KEY }}
101114
EV_TSA_URL: ${{ vars.EV_TSA_URL }}
102115
GCLOUD_ACCESS_TOKEN: ${{ steps.windows_signing.outputs.gcloud_access_token }}
103-
# Updater signing (optional)
104-
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
105-
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
116+
# Updater signing (optional — only set when the secret exists)
117+
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY || '' }}
118+
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD || '' }}
106119
with:
107-
tagName: v__VERSION__
108-
releaseName: "PR Buddy v__VERSION__"
120+
tagName: ${{ github.ref_name }}
121+
releaseName: "PR Buddy ${{ github.ref_name }}"
109122
releaseBody: "See the assets below to download and install this version."
110123
releaseDraft: true
111124
prerelease: false

0 commit comments

Comments
 (0)