Repository navigation
129 lines (111 loc) · 3.36 KB
/
Copy pathrelease.yml
File metadata and controls
129 lines (111 loc) · 3.36 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Release
on:
push:
tags:
- 'release_*'
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
test:
name: Test
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Restore
run: dotnet restore CSharp_CHDMounter.sln
- name: Build
run: dotnet build CSharp_CHDMounter.sln -c Release --no-restore
- name: Test
run: >
dotnet test CHDMounter.Tests/CHDMounter.Tests.csproj
-c Release --no-build
--logger "trx;LogFileName=test-results.trx"
--results-directory TestResults
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: TestResults/*.trx
if-no-files-found: ignore
package:
name: Package bundles (${{ matrix.os }})
needs: test
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
rids: win-x64,win-arm64
- os: ubuntu-latest
rids: linux-x64,linux-arm64
- os: macos-latest
rids: osx-x64,osx-arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Determine version from tag
id: version
shell: pwsh
run: |
$version = '${{ github.ref_name }}' -replace '^release_', ''
if ([string]::IsNullOrWhiteSpace($version)) { throw 'Could not determine version from tag' }
"version=$version" >> $env:GITHUB_OUTPUT
# Each runner packs its own platform's bundles so Unix archives keep the
# executable permission bit.
- name: Pack release bundles
shell: pwsh
run: ./build/pack-release.ps1 -Version "${{ steps.version.outputs.version }}" -OutputDir "${{ github.workspace }}/artifacts" -Runtime "${{ matrix.rids }}"
- name: Upload bundles
uses: actions/upload-artifact@v4
with:
name: bundles-${{ matrix.os }}
path: artifacts/*.zip
if-no-files-found: error
release:
name: Publish GitHub release
needs: [test, package]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download bundles
uses: actions/download-artifact@v4
with:
pattern: bundles-*
path: artifacts
merge-multiple: true
- name: Create or update release
env:
GH_TOKEN: ${{ github.token }}
run: |
set -e
tag='${{ github.ref_name }}'
if gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release upload "$tag" artifacts/*.zip --repo "$GITHUB_REPOSITORY" --clobber
else
gh release create "$tag" artifacts/*.zip \
--repo "$GITHUB_REPOSITORY" \
--title "$tag" \
--notes-file WhatsNew.md
fi
docs:
name: Deploy documentation
needs: test
permissions:
contents: write
pages: write
id-token: write
uses: ./.github/workflows/docs.yml