-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (55 loc) · 1.91 KB
/
build.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
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Upload .NET Package
on: push
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Skip extraction of XML docs - generally not useful within an image/container - helps performance
NUGET_XMLDOC_MODE: 'skip'
# Project name to pack and publish
PROJECT_NAME: Systemathics.Apis
# Official NuGet Feed settings
# NUGET_FEED: https://api.nuget.org/v3/index.json
# NUGET_KEY: ${{ secrets.NUGET_ORG_API_KEY }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
deploy:
needs: build
# commit contains a tag => deploy
if: startsWith( github.ref, 'refs/tags/v' )
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Set VERSION environment variable
run: |
echo GitHub_ref: $GITHUB_REF
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
echo Version: $VERSION
VERSION="${VERSION//v}"
echo Clean Version: $VERSION
echo "VERSION=${VERSION}" >> $GITHUB_ENV
- name: Create Release NuGet package
run: dotnet pack -v normal -c Release -p:PackageVersion=${{ env.VERSION }} -o nupkg src/Systemathics.Apis.csproj
- name: Publish the package to nuget.org
run: dotnet nuget push ./nupkg/Systemathics.Apis.${{ env.VERSION }}.nupkg -k $NUGET_ORG_TOKEN -s https://api.nuget.org/v3/index.json
env:
NUGET_ORG_TOKEN: ${{ secrets.NUGET_ORG_TOKEN }}