-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (87 loc) · 2.72 KB
/
release.yaml
File metadata and controls
99 lines (87 loc) · 2.72 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
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Version Number"
required: true
type: string
jobs:
version:
name: Validate version
runs-on: ubuntu-latest
outputs:
version_3: ${{ steps.version.outputs.version_3 }}
version_suffix: ${{ steps.version.outputs.version_suffix }}
version_full: ${{ steps.version.outputs.version_full }}
is_prerelease: ${{ steps.version.outputs.is_prerelease }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
sparse-checkout: build
- name: Parse version
id: version
run: ./build/Get-Version.ps1 -Version ${{ inputs.version }}
shell: pwsh
build:
name: (.NET) Build & Test
uses: ./.github/workflows/build-dotnet.yaml
permissions:
id-token: write
contents: read
checks: write
publish:
name: Publish
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
needs:
- version
- build
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Restore cache
uses: actions/cache@v5
with:
path: ${{ github.workspace }}/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Pack
run: dotnet pack -p:VersionPrefix="${{ needs.version.outputs.version_3 }}" --version-suffix "${{ needs.version.outputs.version_suffix }}"
- name: NuGet login
uses: NuGet/login@v1
id: login
with:
user: ${{ secrets.NUGET_USER }}
- name: Publish
run: dotnet nuget push "*.nupkg" --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
working-directory: .nupkgs
- name: Create tag
uses: actions/github-script@v8
env:
TAG: v${{ needs.version.outputs.version_full }}
with:
script: |
const tag = process.env.TAG;
const createTag = require('./build/create-tag.js');
await createTag({tag, github, context});
- name: Create GitHub release
uses: ncipollo/release-action@v1
with:
tag: v${{ needs.version.outputs.version_full }}
draft: true
generateReleaseNotes: true
artifacts: ".nupkgs/*"
allowUpdates: true
updateOnlyUnreleased: true
prerelease: ${{ needs.version.outputs.is_prerelease }}