-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (94 loc) · 2.88 KB
/
nuget-publish.yml
File metadata and controls
102 lines (94 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: 协调打包与发布
on:
push:
branches: [main, develop, master]
tags:
- "v*"
paths-ignore:
- 'docs/**'
- 'README.md'
- 'README_en.md'
- 'ROADMAP.md'
- 'CHANGELOG.md'
- '.github/workflows/docs-pages.yml'
pull_request:
branches: [main, develop, master]
paths-ignore:
- 'docs/**'
- 'README.md'
- 'README_en.md'
- 'ROADMAP.md'
- 'CHANGELOG.md'
- '.github/workflows/docs-pages.yml'
workflow_dispatch:
inputs:
version:
description: "版本号:支持 9.5.0.5 或 v9.5.0.5 格式"
required: true
default: "9.5.0.5"
publish_nuget:
description: "是否发布到 NuGet.org"
type: boolean
default: true
publish_github:
description: "是否发布到 GitHub Packages"
type: boolean
default: true
env:
# 版本来源:优先使用 workflow_dispatch 输入,其次使用 tag 名称。
# 注意:tag/输入值可能含有 'v' 前缀(如 v9.5.0.5),会在 prepare 步骤中去除。
PACKAGE_VERSION: ${{ github.event.inputs.version || github.ref_name }}
jobs:
prepare:
name: 调用准备阶段
uses: ./.github/workflows/prepare-release.yml
with:
package_version: ${{ env.PACKAGE_VERSION }}
permissions:
contents: read
# 1. 准备版本元数据与原生库制品
build-native:
name: 调用原生库构建阶段
needs: prepare
uses: ./.github/workflows/build-native.yml
permissions:
contents: read
# 2. 生成 NuGet 包制品
pack:
name: 调用 NuGet 打包阶段
needs: [prepare, build-native]
uses: ./.github/workflows/pack-nuget.yml
with:
package_version: ${{ needs.prepare.outputs.package_version }}
permissions:
contents: read
# 3. 仅在 tag 或手动发布时生成 demo 资产
build-demos:
name: 调用 Demo 构建阶段
needs: prepare
uses: ./.github/workflows/build-demos.yml
with:
package_version: ${{ needs.prepare.outputs.package_version }}
permissions:
contents: read
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
publish:
name: 调用发布阶段
needs: [prepare, pack, build-demos]
uses: ./.github/workflows/publish-release.yml
with:
release_tag: ${{ needs.prepare.outputs.release_tag }}
publish_nuget: ${{ startsWith(github.ref, 'refs/tags/') || github.event.inputs.publish_nuget == 'true' }}
publish_github: ${{ startsWith(github.ref, 'refs/tags/') || github.event.inputs.publish_github == 'true' }}
permissions:
contents: write
packages: write
if: |
startsWith(github.ref, 'refs/tags/') ||
(
github.event_name == 'workflow_dispatch' &&
(
github.event.inputs.publish_nuget == 'true' ||
github.event.inputs.publish_github == 'true'
)
)