@@ -147,7 +147,23 @@ jobs:
147147 name : 📦 Build Packages
148148 if : startsWith(github.ref, 'refs/tags/')
149149 needs : build-and-test
150- runs-on : ubuntu-latest
150+ runs-on : ${{ matrix.os }}
151+ strategy :
152+ matrix :
153+ include :
154+ - build : linux-amd64
155+ os : ubuntu-latest
156+ target : x86_64-unknown-linux-gnu
157+ arch_suffix : amd64
158+ rpm_arch : x86_64
159+ rust_flags : " -C target-cpu=x86-64"
160+
161+ - build : linux-arm64
162+ os : ubuntu-latest
163+ target : aarch64-unknown-linux-gnu
164+ arch_suffix : arm64
165+ rpm_arch : aarch64
166+ rust_flags : " -C target-cpu=generic"
151167 outputs :
152168 version : ${{ steps.get_version.outputs.VERSION }}
153169 steps :
@@ -163,7 +179,15 @@ jobs:
163179 - name : 🦀 Install Rust
164180 uses : dtolnay/rust-toolchain@stable
165181 with :
166- targets : x86_64-unknown-linux-gnu
182+ targets : ${{ matrix.target }}
183+
184+ - name : 📦 Setup cross-compilation (ARM64)
185+ if : matrix.target == 'aarch64-unknown-linux-gnu'
186+ run : |
187+ sudo apt-get update
188+ sudo apt-get install -y gcc-aarch64-linux-gnu
189+ echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
190+ echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
167191
168192 - name : 📦 Rust cache
169193 uses : Swatinem/rust-cache@v2
@@ -177,16 +201,18 @@ jobs:
177201 run : cargo install cargo-deb
178202
179203 - name : 🔨 Build .deb package
204+ env :
205+ RUSTFLAGS : ${{ matrix.rust_flags }}
180206 run : |
181- echo "::group::Building .deb package"
182- cargo deb
207+ echo "::group::Building .deb package for ${{ matrix.target }} "
208+ cargo deb --target ${{ matrix.target }}
183209 echo "::endgroup::"
184210
185211 - name : 📤 Upload DEB artifact
186212 uses : actions/upload-artifact@v4
187213 with :
188- name : git-iris-deb
189- path : ./target/debian/git-iris_${{ steps.get_version.outputs.VERSION }}-1_amd64 .deb
214+ name : git-iris-deb-${{ matrix.arch_suffix }}
215+ path : ./target/${{ matrix.target }}/ debian/git-iris_${{ steps.get_version.outputs.VERSION }}-1_${{ matrix.arch_suffix }} .deb
190216 if-no-files-found : error
191217 retention-days : 1
192218
@@ -195,24 +221,29 @@ jobs:
195221 run : cargo install cargo-generate-rpm
196222
197223 - name : 🔨 Build Release Binary for RPM
198- run : cargo build --release
224+ env :
225+ RUSTFLAGS : ${{ matrix.rust_flags }}
226+ run : cargo build --release --target ${{ matrix.target }}
199227
200228 - name : 🔨 Build .rpm package
229+ env :
230+ RUSTFLAGS : ${{ matrix.rust_flags }}
201231 run : |
202- echo "::group::Building .rpm package"
203- cargo generate-rpm
232+ echo "::group::Building .rpm package for ${{ matrix.target }} "
233+ cargo generate-rpm --target ${{ matrix.target }}
204234 echo "::endgroup::"
205235
206236 - name : 📤 Upload RPM artifact
207237 uses : actions/upload-artifact@v4
208238 with :
209- name : git-iris-rpm
210- path : ./target/generate-rpm/git-iris-${{ steps.get_version.outputs.VERSION }}-1.x86_64 .rpm
239+ name : git-iris-rpm-${{ matrix.arch_suffix }}
240+ path : ./target/generate-rpm/git-iris-${{ steps.get_version.outputs.VERSION }}-1.${{ matrix.rpm_arch }} .rpm
211241 if-no-files-found : error
212242 retention-days : 1
213243
214- # Upload man page as artifact
244+ # Upload man page as artifact (only once)
215245 - name : 📤 Upload man page artifact
246+ if : matrix.build == 'linux-amd64'
216247 uses : actions/upload-artifact@v4
217248 with :
218249 name : git-iris-man
0 commit comments