This commit is contained in:
@@ -1,13 +1,19 @@
|
||||
name: build-service
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
compile-binaries:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
@@ -15,22 +21,44 @@ jobs:
|
||||
- name: install-rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: aarch64-unknown-linux-gnu, x86_64-unknown-linux-gnu
|
||||
targets: aarch64-unknown-linux-gnu,x86_64-unknown-linux-gnu
|
||||
|
||||
- name: build-x86
|
||||
run: cargo build --release --target x86_64-unknown-linux-gnu
|
||||
|
||||
- name: build-arm64
|
||||
# Note: For ARM64 cross-compiling on x86, we use 'cross' or a linker
|
||||
env:
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
||||
run: cargo build --release --target aarch64-unknown-linux-gnu
|
||||
|
||||
- name: prepare-release-files
|
||||
run: |
|
||||
sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
|
||||
cargo build --release --target aarch64-unknown-linux-gnu
|
||||
mkdir -p dist
|
||||
|
||||
cp target/x86_64-unknown-linux-gnu/release/escape_room_server \
|
||||
dist/escape_room_server-linux-x86_64
|
||||
|
||||
cp target/aarch64-unknown-linux-gnu/release/escape_room_server \
|
||||
dist/escape_room_server-linux-arm64
|
||||
|
||||
chmod +x dist/*
|
||||
|
||||
cd dist
|
||||
|
||||
zip escape_room_server-linux-x86_64.zip \
|
||||
escape_room_server-linux-x86_64
|
||||
|
||||
zip escape_room_server-linux-arm64.zip \
|
||||
escape_room_server-linux-arm64
|
||||
|
||||
- name: upload-artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: escape-room-binaries
|
||||
path: |
|
||||
target/x86_64-unknown-linux-gnu/release/escape_room_server
|
||||
target/aarch64-unknown-linux-gnu/release/escape_room_server
|
||||
path: dist/*.zip
|
||||
|
||||
- name: create-release
|
||||
if: startsWith(gitea.ref, 'refs/tags/v')
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: dist/*.zip
|
||||
|
||||
Reference in New Issue
Block a user