|
5 | 5 | tags: ['v*'] |
6 | 6 |
|
7 | 7 | 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 | + |
8 | 44 | release: |
| 45 | + needs: build-native |
9 | 46 | runs-on: ubuntu-latest |
10 | 47 | environment: nuget |
11 | 48 | permissions: |
|
23 | 60 | - run: dotnet pack --no-build -c Release -p:Version=${{ env.VERSION }} -o ./artifacts |
24 | 61 | - name: Push to NuGet |
25 | 62 | 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 |
26 | 74 | - name: Create GitHub Release |
27 | 75 | uses: softprops/action-gh-release@v2 |
28 | 76 | with: |
29 | | - files: artifacts/*.nupkg |
| 77 | + files: artifacts/* |
30 | 78 | generate_release_notes: true |
0 commit comments