Repository navigation
102 lines (84 loc) · 2.84 KB
/
Copy pathci.yml
File metadata and controls
102 lines (84 loc) · 2.84 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
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
94
95
96
97
98
99
100
101
102
name: CI
on:
push:
branches: [master, main]
tags: ['v*']
pull_request:
branches: [master, main]
permissions:
contents: write
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
jobs:
build-and-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
with:
# MinVer needs the v-prefixed tags; the default shallow checkout
# has none, falling back to 0.0.0-alpha (and AssemblyVersion
# 0.0.0.0, which breaks XISOSharp's ZArchiveSharp reference).
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal
pack:
runs-on: ubuntu-latest
needs: build-and-test
steps:
- uses: actions/checkout@v4
with:
# MinVer needs the tags so tagged builds pack the release version.
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Restore
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Pack
run: dotnet pack ZArchiveSharp/ZArchiveSharp.csproj --no-build --configuration Release --output ./artifacts
&& dotnet pack ZArchiveSharp.Cli/ZArchiveSharp.Cli.csproj --no-build --configuration Release --output ./artifacts
- name: Upload NuGet artifacts
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: |
./artifacts/*.nupkg
./artifacts/*.snupkg
publish:
runs-on: ubuntu-latest
needs: pack
if: startsWith(github.ref, 'refs/tags/v')
environment: nuget
steps:
# Needed for global.json (setup-dotnet reads it); the packages come
# from the downloaded artifact, not the checkout.
- uses: actions/checkout@v4
- name: Download NuGet artifacts
uses: actions/download-artifact@v4
with:
name: nuget-packages
path: ./artifacts
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Publish to NuGet
run: |
dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
dotnet nuget push ./artifacts/*.snupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate