-
-
Notifications
You must be signed in to change notification settings - Fork 3
165 lines (144 loc) · 4.99 KB
/
release.yml
File metadata and controls
165 lines (144 loc) · 4.99 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Make Release
run-name: ${{ inputs.dryrun && '(Dry Run) ' || '' }}Make ${{ inputs.prerelease && format('prerelease with suffix ''{0}''', inputs.prerelease-str) || 'release' }} on ${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
dryrun:
description: Dry Run
type: boolean
default: true
bumpkind:
description: Version slot to bump after making release
type: choice
required: true
default: Patch
options:
- Patch
- Minor
- Major
prerelease:
description: This is a prerelease
type: boolean
default: false
prerelease-str:
description: Prerelease suffix
type: string
default: ""
defaults:
run:
shell: pwsh
env:
DOTNET_TELEMETRY_OPTOUT: ttrue
DOTNET_NOLOGO: true
NUGET_PACKAGES: ${{github.workspace}}/artifacts/pkg
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
ver: ${{ steps.computever.outputs.ver }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Get Version
id: computever
run: |
$ver = ([xml](Get-Content Version.props)).Project.PropertyGroup.VersionPrefix;
$suffix = "${{ inputs.prerelease && format('-{0}', inputs.prerelease-str) || '' }}"
echo "ver=$($ver)$($suffix)" >> $env:GITHUB_OUTPUT
build:
needs: [setup]
if: needs.setup.outputs.should_skip != 'true'
name: "Build ${{ needs.setup.outputs.ver }}"
uses: ./.github/workflows/build.yml
with:
version: ${{ inputs.prerelease-str }}
no-suffix: ${{ !inputs.prerelease }}
upload-github:
needs: [setup, build]
if: "!inputs.dryrun"
name: Upload Packages (GitHub)
uses: ./.github/workflows/upload-packages.yml
with:
run-id: ${{ github.run_id }}
upload-nuget:
needs: [setup, build]
if: "!inputs.dryrun"
name: Upload Packages (NuGet)
uses: ./.github/workflows/upload-packages.yml
with:
run-id: ${{ github.run_id }}
nuget-url: nuget.org
secrets:
nuget-key: ${{ secrets.NUGET_PUSH_KEY }}
bump-ver:
name: Bump versions
needs: [setup, upload-github, upload-nuget]
if: ${{ !failure() && !cancelled() }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Authenticate as app
uses: actions/create-github-app-token@v2
id: app_tok
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVKEY }}
- name: Checkout
uses: actions/checkout@v6
with:
token: ${{ steps.app_tok.outputs.token }} # checkout using the app token so we can push directly to the repo head
lfs: true
submodules: true
- name: Download compiled packages
uses: actions/download-artifact@v7
with:
name: packages
path: artifacts/package/release/
github-token: ${{ github.token }}
run-id: ${{ github.run_id }}
# first, make release/tag
- name: Create release
uses: softprops/action-gh-release@v2
if: "!inputs.dryrun"
with:
token: ${{ steps.app_tok.outputs.token }}
files: artifacts/package/release/*.nupkg
tag_name: v${{ needs.setup.outputs.ver }}
prerelease: ${{ inputs.prerelease }}
generate_release_notes: true
# NOTE: manual package caching
- name: Cache restored NuGet packages
if: "!inputs.prerelease"
uses: actions/cache@v5
with:
path: ${{ env.NUGET_PACKAGES }}
key: ${{ runner.os }}-nuget-v1-${{ hashFiles('**/*.csproj', '**/*.props', '**/*.targets', 'nuget.config', 'global.json') }}
restore-keys: ${{ runner.os }}-nuget-v1-
- name: Install .NET SDK
if: "!inputs.prerelease"
uses: nike4613/install-dotnet@cc706db77ed67745a4a4cbae19b2869220e34d27
with:
global-json: global.json
# then, bump the version (if appropriate)
- name: Update version
if: "!inputs.prerelease"
run: ./tools/bump_version.ps1 -BumpVersion ${{ inputs.bumpkind }}
- name: Update compat suppressions
if: "!inputs.prerelease"
run: |
dotnet pack -c Release -clp:NoSummary -noAutoRsp -p:RunAnalyzers=false -p:ApiCompatGenerateSuppressionFile=true
- name: Commit updated version
if: "!inputs.prerelease"
uses: EndBug/add-and-commit@v9
with:
message: |
[BOT]: Bump version after ${{ needs.setup.outputs.ver }} release
[skip-ci]
default_author: github_actions
push: ${{ !inputs.dryrun && 'origin --force --set-upstream' || 'false' }}
pathspec_error_handling: exitAtEnd