File tree Expand file tree Collapse file tree 1 file changed +39
-1
lines changed
Expand file tree Collapse file tree 1 file changed +39
-1
lines changed Original file line number Diff line number Diff line change 1- # Tauri 桌面端:仅构建(不发布),用于 PR 与 main 分支
1+ # Tauri 桌面端:构建;推 main 且构建成功后打 tag 并推送,触发发布工作流
22# 触发:推送到 main、或向 main/release 提 PR
33name : Build Desktop (CI)
44
5555 with :
5656 projectPath : desktop
5757 args : ${{ matrix.args }}
58+
59+ # 仅 push 到 main 时:构建成功后打 tag 并推送,触发 Build and Release Desktop 发布
60+ tag-and-release :
61+ needs : build-tauri
62+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
63+ runs-on : ubuntu-latest
64+ permissions :
65+ contents : write
66+ steps :
67+ - name : Checkout
68+ uses : actions/checkout@v4
69+ with :
70+ fetch-depth : 0
71+
72+ - name : Get version from tauri.conf.json
73+ id : version
74+ shell : bash
75+ run : |
76+ V=$(node -p "require('./desktop/src-tauri/tauri.conf.json').version")
77+ echo "version=$V" >> $GITHUB_OUTPUT
78+ echo "tag=desktop-v$V" >> $GITHUB_OUTPUT
79+
80+ - name : Check if tag exists
81+ id : check-tag
82+ run : |
83+ if git ls-remote --exit-code --tags origin refs/tags/${{ steps.version.outputs.tag }}; then
84+ echo "exists=true" >> $GITHUB_OUTPUT
85+ else
86+ echo "exists=false" >> $GITHUB_OUTPUT
87+ fi
88+
89+ - name : Create and push tag
90+ if : steps.check-tag.outputs.exists != 'true'
91+ run : |
92+ git config user.name "github-actions[bot]"
93+ git config user.email "github-actions[bot]@users.noreply.github.com"
94+ git tag -a "${{ steps.version.outputs.tag }}" -m "Desktop ${{ steps.version.outputs.version }} (auto from CI)"
95+ git push origin "${{ steps.version.outputs.tag }}"
You can’t perform that action at this time.
0 commit comments