This commit is contained in:
@@ -1,13 +1,19 @@
|
|||||||
name: build-service
|
name: build-service
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches:
|
||||||
tags: ["v*"]
|
- main
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
compile-binaries:
|
compile-binaries:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -15,22 +21,44 @@ jobs:
|
|||||||
- name: install-rust
|
- name: install-rust
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
with:
|
with:
|
||||||
targets: aarch64-unknown-linux-gnu, x86_64-unknown-linux-gnu
|
targets: aarch64-unknown-linux-gnu,x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
- name: build-x86
|
- name: build-x86
|
||||||
run: cargo build --release --target x86_64-unknown-linux-gnu
|
run: cargo build --release --target x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
- name: build-arm64
|
- 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: |
|
run: |
|
||||||
sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
|
mkdir -p dist
|
||||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc \
|
|
||||||
cargo build --release --target aarch64-unknown-linux-gnu
|
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
|
- name: upload-artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: escape-room-binaries
|
name: escape-room-binaries
|
||||||
path: |
|
path: dist/*.zip
|
||||||
target/x86_64-unknown-linux-gnu/release/escape_room_server
|
|
||||||
target/aarch64-unknown-linux-gnu/release/escape_room_server
|
- 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