-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (40 loc) · 1.49 KB
/
release.yml
File metadata and controls
52 lines (40 loc) · 1.49 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
name: Release
on:
release:
types: [ published ]
permissions:
contents: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract version and detect .NET version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
MAJOR=$(echo $VERSION | cut -d. -f1)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "DOTNET_VERSION=${MAJOR}.0.x" >> $GITHUB_OUTPUT
echo "Detected version: $VERSION, .NET version: ${MAJOR}.0.x"
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ steps.version.outputs.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore CompactifAI.sln
- name: Build
run: dotnet build CompactifAI.sln --configuration Release --no-restore
- name: Test
run: dotnet test CompactifAI.sln --configuration Release --no-build --verbosity normal
- name: Pack
run: dotnet pack src/CompactifAI.Client/CompactifAI.Client.csproj --configuration Release --no-build --output ./nupkg /p:Version=${{ steps.version.outputs.VERSION }}
- name: Push to NuGet
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
- name: Upload package to release
uses: softprops/action-gh-release@v1
with:
files: ./nupkg/*.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}