55 tags :
66 - " v*"
77 workflow_dispatch :
8+ inputs :
9+ tag :
10+ description : " Existing git tag to release (e.g. v0.5.0)"
11+ required : true
12+ type : string
813
914permissions :
1015 contents : write
2429
2530 steps :
2631 - uses : actions/checkout@v4
32+ with :
33+ fetch-depth : 0
34+
35+ - name : Resolve release tag
36+ id : release_tag
37+ shell : bash
38+ run : |
39+ if [ "${{ github.event_name }}" = "push" ]; then
40+ TAG="${GITHUB_REF_NAME}"
41+ else
42+ TAG="${{ inputs.tag }}"
43+ fi
44+
45+ if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.]+)?$ ]]; then
46+ echo "Invalid tag format: $TAG"
47+ echo "Expected format like v0.5.0"
48+ exit 1
49+ fi
50+
51+ git fetch --tags --force
52+ if ! git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then
53+ echo "Tag not found: $TAG"
54+ echo "Create/push the tag first, then re-run release."
55+ exit 1
56+ fi
57+
58+ echo "version=$TAG" >> "$GITHUB_OUTPUT"
2759
2860 # ── macOS: universal binary needs both targets ──────────────────────────
2961 - name : Add macOS targets
@@ -42,18 +74,11 @@ jobs:
4274 - name : Install frontend dependencies
4375 run : npm ci
4476
45- - name : Read version from package.json
46- id : pkg_version
47- shell : bash
48- run : |
49- VERSION=$(node -e "console.log(require('./package.json').version)")
50- echo "version=v${VERSION}" >> "$GITHUB_OUTPUT"
51-
5277 - name : Extract release notes from CHANGELOG.md
5378 id : changelog
5479 shell : bash
5580 run : |
56- VERSION_NO_V="${{ steps.pkg_version .outputs.version }}"
81+ VERSION_NO_V="${{ steps.release_tag .outputs.version }}"
5782 VERSION_NO_V="${VERSION_NO_V#v}"
5883
5984 SECTION=$(awk -v version="$VERSION_NO_V" '
91116 TAURI_SIGNING_PRIVATE_KEY : ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
92117 TAURI_SIGNING_PRIVATE_KEY_PASSWORD : ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
93118 with :
94- tagName : ${{ steps.pkg_version .outputs.version }}
95- releaseName : " TimeLens ${{ steps.pkg_version .outputs.version }}"
119+ tagName : ${{ steps.release_tag .outputs.version }}
120+ releaseName : " TimeLens ${{ steps.release_tag .outputs.version }}"
96121 releaseBody : ${{ steps.changelog.outputs.notes }}
97122 releaseDraft : false
98123 prerelease : false
0 commit comments