-
Notifications
You must be signed in to change notification settings - Fork 6
119 lines (102 loc) · 3.4 KB
/
Copy pathrelease.yml
File metadata and controls
119 lines (102 loc) · 3.4 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
rid: win-x64
artifact: disttopic-assets-and-map-editor-windows-x64
- os: windows-latest
rid: win-arm64
artifact: disttopic-assets-and-map-editor-windows-arm64
- os: macos-latest
rid: osx-arm64
artifact: disttopic-assets-and-map-editor-macos-arm64
- os: macos-latest
rid: osx-x64
artifact: disttopic-assets-and-map-editor-macos-x64
- os: ubuntu-latest
rid: linux-x64
artifact: disttopic-assets-and-map-editor-linux-x64
- os: ubuntu-latest
rid: linux-arm64
artifact: disttopic-assets-and-map-editor-linux-arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0.x'
- name: Restore
run: dotnet restore src/App/AssetsAndMapEditor.App.csproj -r ${{ matrix.rid }}
- name: Publish
run: >
dotnet publish src/App/AssetsAndMapEditor.App.csproj
-c Release
-r ${{ matrix.rid }}
--self-contained true
-p:PublishSingleFile=true
-p:IncludeNativeLibrariesForSelfExtract=true
-o publish/${{ matrix.artifact }}
- name: Zip (Windows)
if: runner.os == 'Windows'
run: Compress-Archive -Path publish/${{ matrix.artifact }}/* -DestinationPath ${{ matrix.artifact }}.zip
- name: Zip (macOS / Linux)
if: runner.os != 'Windows'
run: cd publish/${{ matrix.artifact }} && zip -r ../../${{ matrix.artifact }}.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}.zip
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Compute SHA-256 checksums
run: |
cd artifacts
find . -name "*.zip" | sort | xargs sha256sum | sed 's|\./||g' > checksums.sha256
echo "Generated checksums:"
cat checksums.sha256
- name: Extract release notes from changelog
id: changelog
run: |
TAG="${GITHUB_REF#refs/tags/}"
BODY=$(awk -v ver="$TAG" '
BEGIN { found=0 }
/^## \[/ {
if (found) exit
if (index($0, "[" ver "]") > 0) { found=1; next }
}
found { print }
' CHANGELOG.md)
if [ -z "$BODY" ]; then
BODY="Release ${TAG}"
fi
echo "$BODY" > release_notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
prerelease: ${{ contains(github.ref_name, 'preview') || contains(github.ref_name, 'rc') || contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') }}
body_path: release_notes.md
files: |
artifacts/**/*.zip
artifacts/checksums.sha256