-
Notifications
You must be signed in to change notification settings - Fork 4
58 lines (47 loc) · 1.72 KB
/
publish-github.yml
File metadata and controls
58 lines (47 loc) · 1.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
name: Publish to GitHub Packages
on:
push:
tags:
- 'github-*.*.*'
- 'github-*.*.*-preview*'
- 'github-*.*.*-rc*'
permissions:
contents: read
packages: write
jobs:
publish-github:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '9.x'
- name: Extract version from tag
id: extract_version
run: echo "VERSION=${GITHUB_REF#refs/tags/github-}" >> $GITHUB_ENV
- name: Restore workloads
run: dotnet workload restore
- name: Restore dependencies
run: dotnet restore
- name: Build solution
run: dotnet build --configuration Release --no-restore /p:Version=${{ env.VERSION }}
- name: Pack NuGet packages
run: dotnet pack --configuration Release --no-build --output ./nupkgs /p:PackageVersion=${{ env.VERSION }}
- name: Create nuget.config
run: |
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>
<configuration>
<packageSources>
<add key=\"github\" value=\"https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json\" />
</packageSources>
<packageSourceCredentials>
<github>
<add key=\"Username\" value=\"${{ github.actor }}\" />
<add key=\"ClearTextPassword\" value=\"${{ secrets.GH_PAT }}\" />
</github>
</packageSourceCredentials>
</configuration>" > nuget.config
- name: Publish NuGet packages to GitHub Packages
run: dotnet nuget push ./nupkgs/*.nupkg --source "github" --api-key ${{ secrets.GH_PAT }}