Repository navigation
90 lines (81 loc) · 2.75 KB
/
Copy pathrelease-package.yml
File metadata and controls
90 lines (81 loc) · 2.75 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
name: Publish NuGet package
on:
workflow_dispatch:
permissions:
contents: write
issues: write
pull-requests: write
packages: write
jobs:
prereleaseCheck:
runs-on: ubuntu-latest
environment: AsyncAPI
name: Check release
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Get release token
id: get-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_SECRET }}
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
id: semantic
with:
extra_plugins: |
@semantic-release/changelog@6.0.3
env:
GITHUB_TOKEN: ${{ steps.get-token.outputs.token }}
- name: Show generated changelog
if: steps.semantic.outputs.new_release_published == 'true'
run: tee -a "$GITHUB_STEP_SUMMARY" < CHANGELOG.md
outputs:
trigger_release: ${{ steps.semantic.outputs.new_release_published }}
version: ${{ steps.semantic.outputs.new_release_published == 'true' && steps.semantic.outputs.new_release_version }}
release:
runs-on: ubuntu-latest
name: Publish NuGet packages
needs: prereleaseCheck
environment: AsyncAPI
permissions:
contents: read
id-token: write
strategy:
matrix:
package-name: [ "ByteBard.AsyncAPI", "ByteBard.AsyncAPI.Readers", "ByteBard.AsyncAPI.Bindings" ]
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Setup .NET
if: needs.prereleaseCheck.outputs.trigger_release == 'true'
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x
- name: Build ${{ matrix.package-name }} project and pack NuGet package
if: needs.prereleaseCheck.outputs.trigger_release == 'true'
run: dotnet pack src/${{ matrix.package-name }}/${{ matrix.package-name }}.csproj -c Release -o out-${{ matrix.package-name }} -p:PackageVersion=${{ needs.prereleaseCheck.outputs.version }}
- name: Authenticate to NuGet
if: needs.prereleaseCheck.outputs.trigger_release == 'true'
uses: NuGet/login@v1
id: nuget-login
with:
user: VisualBean
- name: Push generated package to nuget.org
if: needs.prereleaseCheck.outputs.trigger_release == 'true'
env:
NUGET_API_KEY: ${{ steps.nuget-login.outputs.NUGET_API_KEY }}
run: >
dotnet nuget push
out-${{ matrix.package-name }}/*.nupkg
--source https://api.nuget.org/v3/index.json
--skip-duplicate
--no-symbols
--api-key "$NUGET_API_KEY"