This commit is contained in:
@@ -2,99 +2,68 @@ name: build-service
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [main]
|
||||||
- main
|
tags: ["v*"]
|
||||||
tags:
|
|
||||||
- "v*"
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
compile-binaries:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# 🔥 EVERYTHING runs inside Rust container (no host Rust used)
|
||||||
|
container:
|
||||||
|
image: rust:latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# -----------------------------
|
|
||||||
# Checkout
|
|
||||||
# -----------------------------
|
|
||||||
- name: checkout
|
- name: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# -----------------------------
|
# 🔥 install cross INSIDE container
|
||||||
# Cargo cache (BIG SPEED BOOST)
|
- name: install cross
|
||||||
# -----------------------------
|
run: cargo install cross --locked
|
||||||
- name: cache cargo
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
~/.cargo/registry
|
|
||||||
~/.cargo/git
|
|
||||||
target
|
|
||||||
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
cargo-${{ runner.os }}-
|
|
||||||
|
|
||||||
# -----------------------------
|
# =========================
|
||||||
# Rust toolchain
|
# 🧱 X86_64 BUILD
|
||||||
# -----------------------------
|
# =========================
|
||||||
- name: install-rust
|
- name: build x86_64
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
with:
|
|
||||||
targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Install cross (ARM builds)
|
|
||||||
# -----------------------------
|
|
||||||
- name: install-cross
|
|
||||||
run: cargo install cross --git https://github.com/cross-rs/cross
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Build x86_64 (native)
|
|
||||||
# -----------------------------
|
|
||||||
- name: build-x86
|
|
||||||
run: cargo build --release --target x86_64-unknown-linux-gnu
|
run: cargo build --release --target x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
# -----------------------------
|
# =========================
|
||||||
# Build ARM64 (via cross)
|
# 🧱 ARM64 BUILD (FIXED)
|
||||||
# -----------------------------
|
# =========================
|
||||||
- name: build-arm64
|
- name: build arm64
|
||||||
run: cross build --release --target aarch64-unknown-linux-gnu
|
run: cross build --release --target aarch64-unknown-linux-gnu
|
||||||
|
|
||||||
# -----------------------------
|
# =========================
|
||||||
# Package outputs
|
# 📦 ARTIFACT UPLOAD
|
||||||
# -----------------------------
|
# =========================
|
||||||
- name: prepare-release-files
|
- name: upload artifacts
|
||||||
run: |
|
|
||||||
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
|
|
||||||
|
|
||||||
# -----------------------------
|
|
||||||
# Upload artifacts (CI downloads)
|
|
||||||
# -----------------------------
|
|
||||||
- name: upload-artifacts
|
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: escape-room-binaries
|
name: escape-room-binaries
|
||||||
path: dist/*.zip
|
path: |
|
||||||
|
target/x86_64-unknown-linux-gnu/release/escape_room_server
|
||||||
|
target/aarch64-unknown-linux-gnu/release/escape_room_server
|
||||||
|
|
||||||
# -----------------------------
|
# =========================
|
||||||
# Create Git release on tags
|
# 🚀 CREATE GITEA RELEASE (only on tags)
|
||||||
# -----------------------------
|
# =========================
|
||||||
- name: create-release
|
- name: create release
|
||||||
if: startsWith(gitea.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
uses: softprops/action-gh-release@v2
|
uses: actions/create-release@v1
|
||||||
with:
|
with:
|
||||||
files: dist/*.zip
|
tag_name: ${{ github.ref_name }}
|
||||||
|
release_name: Release ${{ github.ref_name }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
# =========================
|
||||||
|
# 📎 UPLOAD RELEASE ASSETS
|
||||||
|
# =========================
|
||||||
|
- name: upload release assets
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: target/x86_64-unknown-linux-gnu/release/escape_room_server
|
||||||
|
asset_name: escape_room_server-x86_64
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
|||||||
Reference in New Issue
Block a user