forked from shns/TgaLib
-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (35 loc) · 1.16 KB
/
publish.yml
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
name: Publish NuGet Package
on:
push:
tags:
- 'v*' # Triggers on tags starting with 'v', e.g., 'v1.0.0'
branches:
- main # Ensures it's on the 'main' branch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Install dependencies
run: dotnet restore
- name: Build project
run: dotnet build --configuration Release --no-restore
- name: Extract version
id: get_version
shell: bash
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
VERSION=${TAG_NAME#v}
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Extracted version: $VERSION"
- name: Pack NuGet package
run: |
dotnet pack --configuration Release --no-build --output ./artifacts /p:PackageVersion=${{ env.VERSION }}
- name: Publish NuGet package
run: |
dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json