mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-11 01:03:51 +08:00
🔧 ci(release): 支持发布分支触发草稿发布 [skip ci]
- 允许 publish/v* 临时分支触发受校验的发布流程 - 从分支名安全解析目标版本并复用完整资产检查 - 保留 workflow_dispatch 作为具备 Actions 权限时的入口
This commit is contained in:
12
.github/workflows/publish-release.yml
vendored
12
.github/workflows/publish-release.yml
vendored
@@ -1,6 +1,9 @@
|
||||
name: Publish Draft Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'publish/v*'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
@@ -13,7 +16,7 @@ permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: publish-release-${{ inputs.tag }}
|
||||
group: publish-release-${{ inputs.tag || github.ref_name }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
@@ -21,13 +24,16 @@ jobs:
|
||||
name: Validate and publish draft
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
RELEASE_TAG: ${{ inputs.tag }}
|
||||
RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
|
||||
steps:
|
||||
- name: Validate assets and publish
|
||||
uses: actions/github-script@v8
|
||||
with:
|
||||
script: |
|
||||
const tag = String(process.env.RELEASE_TAG || '').trim();
|
||||
const requestedTag = String(process.env.RELEASE_TAG || '').trim();
|
||||
const tag = requestedTag.startsWith('publish/')
|
||||
? requestedTag.slice('publish/'.length)
|
||||
: requestedTag;
|
||||
if (!/^v\d+\.\d+\.\d+$/.test(tag)) {
|
||||
core.setFailed(`Invalid release tag: ${tag}`);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user