fix(release): keep manual desktop releases as drafts

Make workflow_dispatch draft handling explicit and add a post-publish guard that edits the release back to draft when manual draft runs upload assets to an existing release.\n\nTested: bun test scripts/pr/release-workflow.test.ts\nTested: git diff --check\nScope-risk: narrow\nConfidence: high
This commit is contained in:
程序员阿江(Relakkes) 2026-06-17 17:19:27 +08:00
parent 2c1af7a843
commit ad33980c40
2 changed files with 11 additions and 1 deletions

View File

@ -587,7 +587,7 @@ jobs:
tag_name: v${{ steps.version.outputs.value }}
name: Claude Code Haha v${{ steps.version.outputs.value }}
body: ${{ steps.release_notes.outputs.body }}
draft: ${{ github.event_name == 'workflow_dispatch' && inputs.draft || false }}
draft: ${{ github.event_name == 'workflow_dispatch' && inputs.draft == true }}
prerelease: false
fail_on_unmatched_files: true
files: |
@ -599,3 +599,9 @@ jobs:
artifacts/release-assets/**/*.blockmap
artifacts/update-metadata-standard/*.yml
desktop/scripts/install-macos-unsigned.sh
- name: Ensure workflow-dispatch release remains draft
if: github.event_name == 'workflow_dispatch' && inputs.draft == true
env:
GH_TOKEN: ${{ github.token }}
run: gh release edit "v${{ steps.version.outputs.value }}" --draft --repo "${{ github.repository }}"

View File

@ -285,6 +285,10 @@ describe('release desktop workflow', () => {
expect(publishJob).toContain('artifacts/release-assets/**/*.blockmap')
expect(publishJob).toContain('artifacts/update-metadata-standard/*.yml')
expect(publishJob).toContain('desktop/scripts/install-macos-unsigned.sh')
expect(publishJob).toContain("draft: ${{ github.event_name == 'workflow_dispatch' && inputs.draft == true }}")
expect(publishJob).toContain('Ensure workflow-dispatch release remains draft')
expect(publishJob).toContain("if: github.event_name == 'workflow_dispatch' && inputs.draft == true")
expect(publishJob).toContain('gh release edit "v${{ steps.version.outputs.value }}" --draft --repo "${{ github.repository }}"')
expect(publishJob).toContain('fail_on_unmatched_files: true')
expect(publishJob).toContain('Load release notes')
expect(workflow.indexOf('publish-release:')).toBeGreaterThan(workflow.indexOf('build:'))