-
-
Notifications
You must be signed in to change notification settings - Fork 2
51 lines (45 loc) · 1.49 KB
/
dotnet.yml
File metadata and controls
51 lines (45 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
name: .NET
on:
push:
branches: [ master ]
create:
tags:
- '*.*.*'
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- name: Check Tag
id: check-tag
run: |
if [[ v${{ github.event.ref }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "match=true" >> $GITHUB_OUTPUT
fi
- name: Run Unit Tests
run: |
dotnet restore
dotnet build
dotnet test test/NosCore.Algorithm.Tests -v m
- name: Build Artifact
if: steps.check-tag.outputs.match == 'true'
id: build_artifact
run: |
dotnet restore
dotnet build -c Release
dotnet pack -c Release -o /tmp/nupkgs -v m -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
dotnet nuget push /tmp/nupkgs/NosCore.Algorithm.${{github.event.ref}}.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}
echo "ARTIFACT_PATH=/tmp/nupkgs/NosCore.Algorithm.${{github.event.ref}}.nupkg" >> $GITHUB_OUTPUT
echo "ARTIFACT_NAME=NosCore.Algorithm.${{github.event.ref}}.nupkg" >> $GITHUB_OUTPUT
- name: Upload Release Asset
if: steps.check-tag.outputs.match == 'true'
env:
GH_TOKEN: ${{ secrets.REPO_TOKEN }}
run: |
gh release upload ${{ github.event.ref }} ${{ steps.build_artifact.outputs.ARTIFACT_PATH }}