-
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (75 loc) · 2.36 KB
/
github-release.yml
File metadata and controls
85 lines (75 loc) · 2.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
name: GitHub Release
on:
release:
types: [ published ]
jobs:
release:
name: Release
permissions:
id-token: write
attestations: write
artifact-metadata: write
contents: write
strategy:
matrix:
kind: [ 'linux-amd64', 'linux-arm64', 'macos-amd64', 'macos-arm64', 'windows-amd64', 'windows-arm64' ]
include:
- kind: linux-amd64
os: ubuntu-latest
target: linux-x64
- kind: linux-arm64
os: ubuntu-24.04-arm
target: linux-arm64
- kind: macos-amd64
os: macos-15-intel
target: osx-x64
- kind: macos-arm64
os: macos-latest
target: osx-arm64
- kind: windows-amd64
os: windows-latest
target: win-x64
- kind: windows-arm64
os: windows-11-arm
target: win-arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup dotnet
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Build
shell: bash
run: |
tag=$(git describe --tags --abbrev=0)
ASSEMBLY_VERSION="${tag//v}"
# Build everything
release_name="HostsParser-$tag-${{ matrix.kind }}"
dotnet publish "./src/HostsParser/HostsParser.csproj" -r ${{ matrix.target }} -c Release -o release -p:Version="$ASSEMBLY_VERSION"
if [ "${{ matrix.kind }}" = "windows-amd64" ] || [ "${{ matrix.kind }}" = "windows-arm64" ]; then
# Pack to zip for Windows
7z a -tzip "${release_name}.zip" "./release/*"
else
# Pack tar.gz for non-Windows
tar -czvf "${release_name}.tar.gz" -C ./release .
fi
# Delete output directory
rm -r "./release"
- name: Publish
uses: softprops/action-gh-release@b4309332981a82ec1c5618f44dd2e27cc8bfbfda
with:
files: |
HostsParser*.zip
HostsParser*.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Attest build provenance
uses: actions/attest@v4.1.0
with:
subject-path: |
HostsParser*.tar.gz
HostsParser*.zip