-
-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (91 loc) · 3.13 KB
/
pipeline.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: libNOM.map
on:
pull_request:
branches: [ master ]
push:
branches: [ master ]
create:
jobs:
test:
name: Test
strategy:
matrix:
# November, 2024 / May, 2024 / November, 2026
framwork: [{dotnet: 'net6.0', version: '6.0.x'}, {dotnet: 'net7.0', version: '7.0.x'}, {dotnet: 'net8.0', version: '8.0.x'}]
os: ['windows-latest', 'macos-latest', 'ubuntu-latest']
runs-on: ${{ matrix.os }}
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.framwork.version }}
dotnet-quality: ga
- name: Checkout
uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Unit Test
run: dotnet test libNOM.test --configuration Debug --framework ${{ matrix.framwork.dotnet }}
build:
name: Build
strategy:
matrix:
framwork: ['8.0.x'] # must match project file
os: ['ubuntu-latest']
runs-on: ${{ matrix.os }}
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.framwork }}
dotnet-quality: ga
- name: Checkout
uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: ${{ runner.os }}-nuget-
- name: Pack
run: dotnet pack libNOM.map --configuration Release
- name: Upload (NuGet)
uses: actions/upload-artifact@v4
with:
name: NuGet
path: ./libNOM.map/bin/Release/libNOM.map.*nupkg
if-no-files-found: error
- name: Upload (Release)
if: ${{ startsWith(github.ref, 'refs/tags/') }} # only if tagged
uses: actions/upload-artifact@v4
with:
name: Release
path: ./.github/changelogs/${{ github.ref_name }}.md
if-no-files-found: error
release:
name: Release
if: ${{ startsWith(github.ref, 'refs/tags/') }} # only if tagged
runs-on: ubuntu-latest
needs: [test, build]
steps:
- name: Download
uses: actions/download-artifact@v4
- name: Version
run: echo "nupkg_version=$((((Get-Item -Path ./NuGet/libNOM.map.*.nupkg).Name -split '\.',3)[2] -split '\.',-2)[0])" >> $env:GITHUB_ENV
shell: pwsh
- name: Mismatch
if: ${{ github.ref_name != env.nupkg_version }}
run: |
echo "There is a version mismatch between git tag (${{ github.ref_name }}) and nupkg version (${{ env.nupkg_version }})!"
exit 1
- name: Create
uses: softprops/action-gh-release@v2
with:
body_path: ./Release/${{ github.ref_name }}.md
files: ./NuGet/libNOM.map.*nupkg
- name: Publish
run: dotnet nuget push ./NuGet/libNOM.map.*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}