-
Notifications
You must be signed in to change notification settings - Fork 2
97 lines (81 loc) · 2.85 KB
/
release.yml
File metadata and controls
97 lines (81 loc) · 2.85 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
name: Release
on:
release:
types: [created]
permissions:
contents: write
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Extract version from tag
id: get_version
run: |
# Remove 'v' prefix if present (e.g., v1.2.3 -> 1.2.3)
VERSION=${GITHUB_REF#refs/tags/}
VERSION=${VERSION#v}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration=Release --no-restore
- name: Test
timeout-minutes: 2
run: dotnet test --configuration=Release --no-build
- name: Pack Activout.RestClient
run: |
dotnet pack Activout.RestClient/Activout.RestClient.csproj \
-p:PackageVersion=${{ steps.get_version.outputs.VERSION }} \
--configuration=Release \
--no-build \
--include-symbols \
--include-source \
--output ./nupkgs
- name: Pack Activout.RestClient.Json
run: |
dotnet pack Activout.RestClient.Json/Activout.RestClient.Json.csproj \
-p:PackageVersion=${{ steps.get_version.outputs.VERSION }} \
--configuration=Release \
--no-build \
--include-symbols \
--include-source \
--output ./nupkgs
- name: Pack Activout.RestClient.Newtonsoft.Json
run: |
dotnet pack Activout.RestClient.Newtonsoft.Json/Activout.RestClient.Newtonsoft.Json.csproj \
-p:PackageVersion=${{ steps.get_version.outputs.VERSION }} \
--configuration=Release \
--no-build \
--include-symbols \
--include-source \
--output ./nupkgs
- name: Pack Activout.RestClient.Xml
run: |
dotnet pack Activout.RestClient.Xml/Activout.RestClient.Xml.csproj \
-p:PackageVersion=${{ steps.get_version.outputs.VERSION }} \
--configuration=Release \
--no-build \
--include-symbols \
--include-source \
--output ./nupkgs
- name: List generated packages
run: ls -lh ./nupkgs/
- name: Upload packages to release
uses: softprops/action-gh-release@v2
with:
files: ./nupkgs/*.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Uncomment to publish to NuGet.org
# - name: Push to NuGet.org
# run: |
# dotnet nuget push ./nupkgs/*.nupkg \
# --api-key ${{ secrets.NUGET_API_KEY }} \
# --source https://api.nuget.org/v3/index.json \
# --skip-duplicate