@@ -10,8 +10,27 @@ permissions:
1010
1111jobs :
1212 build :
13- name : Build release asset (macOS aarch64)
14- runs-on : macos-14
13+ name : Build release asset (${{ matrix.label }})
14+ runs-on : ${{ matrix.os }}
15+ strategy :
16+ fail-fast : false
17+ matrix :
18+ include :
19+ - os : macos-14
20+ label : macOS arm64
21+ artifact_name : insert-dylib-macos-aarch64
22+ binary_name : insert-dylib
23+ archive_glob : dist/*.tar.gz
24+ - os : ubuntu-latest
25+ label : Linux x86_64
26+ artifact_name : insert-dylib-linux-x86_64
27+ binary_name : insert-dylib
28+ archive_glob : dist/*.tar.gz
29+ - os : windows-latest
30+ label : Windows x86_64
31+ artifact_name : insert-dylib-windows-x86_64
32+ binary_name : insert-dylib.exe
33+ archive_glob : dist/*.zip
1534
1635 steps :
1736 - name : Checkout
@@ -20,30 +39,39 @@ jobs:
2039 - name : Install Rust toolchain
2140 uses : dtolnay/rust-toolchain@stable
2241
23- - name : Add target
24- run : rustup target add aarch64-apple-darwin
25-
2642 - name : Cache cargo artifacts
2743 uses : Swatinem/rust-cache@v2
2844
2945 - name : Build release binary
30- run : cargo build --release --target aarch64-apple-darwin
46+ run : cargo build --release
3147
3248 - name : Package archive
49+ if : runner.os != 'Windows'
3350 shell : bash
3451 run : |
3552 set -euo pipefail
36- package_dir="insert-dylib-macos-aarch64 "
53+ package_dir="${{ matrix.artifact_name }} "
3754 mkdir -p dist "$package_dir"
38- cp "target/aarch64-apple-darwin/ release/insert-dylib " "$package_dir/"
55+ cp "target/release/${{ matrix.binary_name }} " "$package_dir/"
3956 cp README.md README.cn.md LICENSE "$package_dir/"
4057 tar -czf "dist/${package_dir}.tar.gz" "$package_dir"
4158
59+ - name : Package archive
60+ if : runner.os == 'Windows'
61+ shell : pwsh
62+ run : |
63+ $packageDir = "${{ matrix.artifact_name }}"
64+ New-Item -ItemType Directory -Force -Path "dist" | Out-Null
65+ New-Item -ItemType Directory -Force -Path $packageDir | Out-Null
66+ Copy-Item "target/release/${{ matrix.binary_name }}" $packageDir
67+ Copy-Item README.md, README.cn.md, LICENSE $packageDir
68+ Compress-Archive -Path "$packageDir/*" -DestinationPath "dist/$packageDir.zip" -Force
69+
4270 - name : Upload workflow artifact
4371 uses : actions/upload-artifact@v4
4472 with :
45- name : insert-dylib-macos-aarch64
46- path : dist/*.tar.gz
73+ name : ${{ matrix.artifact_name }}
74+ path : ${{ matrix.archive_glob }}
4775
4876 publish :
4977 name : Publish GitHub Release
@@ -60,19 +88,20 @@ jobs:
6088 run : |
6189 set -euo pipefail
6290 mkdir -p release-files
63- find dist -type f -name '*.tar.gz' -exec cp {} release-files/ \;
91+ find dist -type f \( -name '*.tar.gz' -o -name '*.zip' \) -exec cp {} release-files/ \;
6492
6593 - name : Generate SHA256 checksums
6694 run : |
6795 set -euo pipefail
6896 cd release-files
69- sha256sum *.tar.gz > SHA256SUMS.txt
97+ sha256sum *.tar.gz *.zip > SHA256SUMS.txt
7098
7199 - name : Create GitHub Release
72100 uses : softprops/action-gh-release@v2
73101 with :
74102 files : |
75103 release-files/*.tar.gz
104+ release-files/*.zip
76105 release-files/SHA256SUMS.txt
77106 generate_release_notes : true
78107 env :
0 commit comments