-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (38 loc) · 1.53 KB
/
release.yml
File metadata and controls
48 lines (38 loc) · 1.53 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
name: Publish NuGet Package
on:
push:
tags:
- 'v*' # e.g., v1.0.0, v1.2.3
jobs:
build:
runs-on: ubuntu-latest
steps:
# 1. Checkout repository
- name: Checkout code
uses: actions/checkout@v4
# 2. Install .NET 6 SDK
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '6.0.x'
# 3. Extract version number from Git tag
- name: Extract version from tag
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV
# 4. Restore dependencies for the library
- name: Restore library dependencies
run: dotnet restore src/Keymapp.NET/Keymapp.NET.csproj
# 5. Build the library
- name: Build library
run: dotnet build src/Keymapp.NET/Keymapp.NET.csproj --configuration Release --no-restore
# 6. Run tests (pointing to your test project)
- name: Run tests
run: dotnet test tests/Keymapp.NET.Tests.Integration/Keymapp.NET.Tests.Integration.csproj --configuration Release --no-build
# 7. Pack the NuGet package
- name: Pack NuGet package
run: dotnet pack src/Keymapp.NET/Keymapp.NET.csproj --configuration Release --no-build -o ./artifacts /p:PackageVersion=${{ env.PACKAGE_VERSION }}
# 8. Publish package to nuget.org
- name: Publish NuGet package
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json