forked from web-push-libs/web-push-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (58 loc) · 2.09 KB
/
Copy pathrelease-nuget.yml
File metadata and controls
72 lines (58 loc) · 2.09 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
name: 🎁 Publish nuget package
on:
workflow_dispatch:
push:
tags:
- "v[0-9]*.[0-9]*.[0-9]*" # Pattern for standard: v1.2.3
- "v[0-9]*.[0-9]*.[0-9]*-*" # Pattern for pre-release: v1.2.3-alpha.1
env:
DOTNET_VERSION: "10.x"
permissions:
contents: write
pull-requests: read
id-token: write
jobs:
release:
runs-on: ubuntu-latest
environment: public-release
steps:
- name: Checkout code
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v6
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
cache: true
cache-dependency-path: '**/packages.lock.json'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v4.7.0
- name: Determine Version
id: meta
uses: gittools/actions/gitversion/execute@v4.7.0
- name: Restore dependencies
run: dotnet restore --locked-mode
- name: Build
run: dotnet build --no-restore -c Release
- name: Test
run: dotnet test --no-build -c Release --verbosity normal
- name: NuGet OIDC login
uses: NuGet/login@v1
id: login
with:
user: ${{ secrets.NUGET_USER }}
- name: Publish the package to NUGET
run: dotnet nuget push ./artifacts/package/release/*.nupkg --source https://api.nuget.org/v3/index.json --api-key "${{steps.login.outputs.NUGET_API_KEY}}" --skip-duplicate
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }}
- name: Create Release
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_type == 'tag' && github.ref_name || format('v{0}', steps.meta.outputs.SemVer) }}
name: ${{ github.ref_type == 'tag' && github.ref_name || format('v{0}', steps.meta.outputs.SemVer) }}
generate_release_notes: true
target_commitish: ${{ github.sha }}
draft: false
prerelease: ${{ steps.meta.outputs.PreReleaseTag != '' }}
make_latest: ${{ steps.meta.outputs.PreReleaseTag == '' }}