Skip to content

Commit 714e8b8

Browse files
committed
Add native AOT binaries to GitHub releases
Build native AOT executables for linux-x64, osx-arm64, and win-x64 using a matrix job and attach them as tar.gz archives alongside the NuGet package on each release.
1 parent 1beb775 commit 714e8b8

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

.github/workflows/release.yml

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,44 @@ on:
55
tags: ['v*']
66

77
jobs:
8+
build-native:
9+
strategy:
10+
matrix:
11+
include:
12+
- os: ubuntu-latest
13+
rid: linux-x64
14+
artifact: git-wt-linux-x64
15+
- os: macos-latest
16+
rid: osx-arm64
17+
artifact: git-wt-osx-arm64
18+
- os: windows-latest
19+
rid: win-x64
20+
artifact: git-wt-win-x64
21+
runs-on: ${{ matrix.os }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: '10.0.x'
27+
- name: Set version from tag
28+
shell: bash
29+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
30+
- name: Publish native AOT
31+
run: >
32+
dotnet publish src/git-wt/git-wt.csproj
33+
-c Release
34+
-r ${{ matrix.rid }}
35+
-p:Version=${{ env.VERSION }}
36+
-p:PublishAot=true
37+
-o ./publish
38+
- name: Upload artifact
39+
uses: actions/upload-artifact@v4
40+
with:
41+
name: ${{ matrix.artifact }}
42+
path: ./publish/git-wt*
43+
844
release:
45+
needs: build-native
946
runs-on: ubuntu-latest
1047
environment: nuget
1148
permissions:
@@ -23,8 +60,19 @@ jobs:
2360
- run: dotnet pack --no-build -c Release -p:Version=${{ env.VERSION }} -o ./artifacts
2461
- name: Push to NuGet
2562
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
63+
- name: Download native binaries
64+
uses: actions/download-artifact@v4
65+
with:
66+
path: ./native
67+
- name: Package native binaries
68+
run: |
69+
cd native
70+
for dir in */; do
71+
name="${dir%/}"
72+
tar -czf "../artifacts/${name}.tar.gz" -C "$dir" .
73+
done
2674
- name: Create GitHub Release
2775
uses: softprops/action-gh-release@v2
2876
with:
29-
files: artifacts/*.nupkg
77+
files: artifacts/*
3078
generate_release_notes: true

src/git-wt/git-wt.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<PackageTags>git;worktree;cli;dotnet-tool</PackageTags>
1515
<PackageReadmeFile>README.md</PackageReadmeFile>
1616
<PackageOutputPath>./nupkg</PackageOutputPath>
17+
<IsAotCompatible>true</IsAotCompatible>
1718
</PropertyGroup>
1819
<ItemGroup>
1920
<PackageReference Include="System.CommandLine" Version="2.0.3" />

0 commit comments

Comments
 (0)