Skip to content

Commit 9800ce4

Browse files
committed
fix bugs
1 parent a824622 commit 9800ce4

4 files changed

Lines changed: 62 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
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

914
permissions:
1015
contents: write
@@ -24,6 +29,33 @@ jobs:
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" '
@@ -91,8 +116,8 @@ jobs:
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

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,19 @@ npm run tauri:build
8383
# macOS: src-tauri/target/release/bundle/dmg/*.dmg
8484
```
8585

86+
### Release Publishing (v0.5.0 example)
87+
88+
```bash
89+
# 1. Push master first (current repo convention)
90+
git push origin refs/heads/master:refs/heads/master
91+
92+
# 2. Create and push the version tag
93+
git tag -a v0.5.0 -m "release: v0.5.0"
94+
git push origin v0.5.0
95+
```
96+
97+
Notes: Pushing a `v*` tag triggers `.github/workflows/release.yml`.
98+
8699
---
87100

88101
## 🗂 Project Structure

README_zh.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,19 @@ npm run tauri:build
8181
# macOS: src-tauri/target/release/bundle/dmg/*.dmg
8282
```
8383

84+
### 发布 Release(以 v0.5.0 为例)
85+
86+
```bash
87+
# 1. 先推送 master(按当前仓库约定)
88+
git push origin refs/heads/master:refs/heads/master
89+
90+
# 2. 创建并推送版本标签
91+
git tag -a v0.5.0 -m "release: v0.5.0"
92+
git push origin v0.5.0
93+
```
94+
95+
说明:推送 `v*` 标签后会触发 `.github/workflows/release.yml` 自动发布流程。
96+
8497
---
8598

8699
## 🗂 项目结构

scripts/build-msix.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Param(
2-
[string]$Version = "0.4.0.0"
2+
[string]$Version = "0.5.0.0"
33
)
44

55
$ErrorActionPreference = "Stop"

0 commit comments

Comments
 (0)