99 CARGO_TERM_COLOR : always
1010 BINARY_NAME : null-e
1111
12+ permissions :
13+ contents : write
14+
1215jobs :
13- # Build binaries for all platforms
1416 build :
1517 name : Build ${{ matrix.target }}
1618 runs-on : ${{ matrix.os }}
1719 strategy :
1820 fail-fast : false
1921 matrix :
2022 include :
21- # macOS
22- - os : macos-latest
23- target : x86_64-apple-darwin
24- artifact_name : null-e
25- asset_name : null-e-x86_64-apple-darwin
26-
27- - os : macos-latest
28- target : aarch64-apple-darwin
29- artifact_name : null-e
30- asset_name : null-e-aarch64-apple-darwin
31-
3223 # Linux
3324 - os : ubuntu-latest
3425 target : x86_64-unknown-linux-gnu
3526 artifact_name : null-e
36- asset_name : null-e-x86_64-unknown-linux-gnu
37-
27+ asset_name : null-e-linux-x86_64
3828 - os : ubuntu-latest
3929 target : x86_64-unknown-linux-musl
4030 artifact_name : null-e
41- asset_name : null-e-x86_64-unknown-linux-musl
42-
31+ asset_name : null-e-linux-x86_64-musl
32+ - os : ubuntu-latest
33+ target : aarch64-unknown-linux-gnu
34+ artifact_name : null-e
35+ asset_name : null-e-linux-aarch64
36+ # macOS
37+ - os : macos-latest
38+ target : x86_64-apple-darwin
39+ artifact_name : null-e
40+ asset_name : null-e-darwin-x86_64
41+ - os : macos-latest
42+ target : aarch64-apple-darwin
43+ artifact_name : null-e
44+ asset_name : null-e-darwin-aarch64
4345 # Windows
4446 - os : windows-latest
4547 target : x86_64-pc-windows-msvc
4648 artifact_name : null-e.exe
47- asset_name : null-e-x86_64-pc- windows-msvc
49+ asset_name : null-e-windows-x86_64
4850
4951 steps :
5052 - uses : actions/checkout@v4
5860 if : matrix.target == 'x86_64-unknown-linux-musl'
5961 run : sudo apt-get update && sudo apt-get install -y musl-tools
6062
63+ - name : Install cross-compilation tools (Linux aarch64)
64+ if : matrix.target == 'aarch64-unknown-linux-gnu'
65+ run : |
66+ sudo apt-get update
67+ sudo apt-get install -y gcc-aarch64-linux-gnu
68+
6169 - name : Cache cargo
6270 uses : actions/cache@v4
6371 with :
@@ -71,37 +79,41 @@ jobs:
7179
7280 - name : Build
7381 run : cargo build --release --target ${{ matrix.target }}
82+ env :
83+ CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER : aarch64-linux-gnu-gcc
7484
75- - name : Package (Unix)
85+ - name : Create tarball (Unix)
7686 if : runner.os != 'Windows'
7787 run : |
7888 cd target/${{ matrix.target }}/release
79- tar - czvf ../../../${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }}
89+ tar czvf ../../../${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }}
8090 cd ../../..
91+ shasum -a 256 ${{ matrix.asset_name }}.tar.gz > ${{ matrix.asset_name }}.tar.gz.sha256
8192
82- - name : Package (Windows)
93+ - name : Create zip (Windows)
8394 if : runner.os == 'Windows'
95+ shell : pwsh
8496 run : |
8597 cd target/${{ matrix.target }}/release
86- 7z a .. /../../${{ matrix.asset_name }}.zip ${{ matrix.artifact_name }}
98+ Compress-Archive -Path ${{ matrix.artifact_name }} -DestinationPath .. /../../${{ matrix.asset_name }}.zip
8799 cd ../../..
100+ (Get-FileHash ${{ matrix.asset_name }}.zip -Algorithm SHA256).Hash.ToLower() + " " + "${{ matrix.asset_name }}.zip" | Out-File -Encoding ASCII ${{ matrix.asset_name }}.zip.sha256
88101
89102 - name : Upload artifact
90103 uses : actions/upload-artifact@v4
91104 with :
92105 name : ${{ matrix.asset_name }}
93106 path : |
94- ${{ matrix.asset_name }}.tar.gz
95- ${{ matrix.asset_name }}.zip
107+ *.tar.gz
108+ *.tar.gz.sha256
109+ *.zip
110+ *.zip.sha256
111+ if-no-files-found : ignore
96112
97- # Create GitHub Release
98113 release :
99114 name : Create Release
100115 needs : build
101116 runs-on : ubuntu-latest
102- permissions :
103- contents : write
104-
105117 steps :
106118 - uses : actions/checkout@v4
107119
@@ -110,44 +122,38 @@ jobs:
110122 with :
111123 path : artifacts
112124
113- - name : Display structure
114- run : ls -la artifacts/
125+ - name : Flatten artifacts
126+ run : |
127+ mkdir -p release
128+ find artifacts -type f \( -name "*.tar.gz" -o -name "*.zip" -o -name "*.sha256" \) -exec mv {} release/ \;
129+ ls -la release/
115130
116131 - name : Create Release
117132 uses : softprops/action-gh-release@v2
118133 with :
119- files : |
120- artifacts/**/*.tar.gz
121- artifacts/**/*.zip
134+ files : release/*
122135 generate_release_notes : true
123136 draft : false
124137 prerelease : ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
125138 env :
126139 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
127140
128- # Publish to crates.io
129- publish-crates :
141+ publish-crate :
130142 name : Publish to crates.io
131143 needs : release
132144 runs-on : ubuntu-latest
133-
134145 steps :
135146 - uses : actions/checkout@v4
136-
137- - name : Install Rust
138- uses : dtolnay/rust-toolchain@stable
139-
140- - name : Publish to crates.io
147+ - uses : dtolnay/rust-toolchain@stable
148+ - name : Publish
141149 run : cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
142- continue-on-error : true # Don't fail if already published
150+ continue-on-error : true
143151
144- # Update Homebrew tap
145152 update-homebrew :
146153 name : Update Homebrew Formula
147154 needs : release
148155 runs-on : ubuntu-latest
149156 if : ${{ !contains(github.ref, 'alpha') && !contains(github.ref, 'beta') && !contains(github.ref, 'rc') }}
150-
151157 steps :
152158 - name : Update Homebrew formula
153159 uses : mislav/bump-homebrew-formula-action@v3
@@ -157,4 +163,4 @@ jobs:
157163 download-url : https://github.com/us/null-e/archive/refs/tags/${{ github.ref_name }}.tar.gz
158164 env :
159165 COMMITTER_TOKEN : ${{ secrets.HOMEBREW_TAP_TOKEN }}
160- continue-on-error : true # Don't fail if tap doesn't exist yet
166+ continue-on-error : true
0 commit comments