-
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (54 loc) · 1.88 KB
/
dotnet.yml
File metadata and controls
59 lines (54 loc) · 1.88 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
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 10
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.0'
continue-on-error: true
- name: Fallback - Install .NET 10 manually
if: failure()
run: |
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
chmod +x dotnet-install.sh
./dotnet-install.sh --channel 10.0 --install-dir $HOME/.dotnet
echo "$HOME/.dotnet" >> $GITHUB_PATH
- 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 --no-build --filter TestCategory!=OPTIONAL-TEST
- 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.Networking.${{github.event.ref}}.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}}
echo "ARTIFACT_PATH=/tmp/nupkgs/NosCore.Networking.${{github.event.ref}}.nupkg" >> $GITHUB_OUTPUT
echo "ARTIFACT_NAME=NosCore.Networking.${{github.event.ref}}.nupkg" >> $GITHUB_OUTPUT
- name: Upload Release Asset
if: steps.check-tag.outputs.match == 'true'
uses: softprops/action-gh-release@v2
with:
files: ${{ steps.build_artifact.outputs.ARTIFACT_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}