d30a4efd9b
Replaces the musl-based static Linux build toolchain with Zig (`ziglang` via pip and `cargo-zigbuild`), removing `musl-tools` dependencies. The workflow now invokes `cargo zigbuild` for cross-compiling the static binary. Additionally, bumps the `obikmer` crate version to 1.1.7.
59 lines
1.9 KiB
YAML
59 lines
1.9 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
build-linux-static:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: src
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust + zigbuild
|
|
run: |
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
|
|
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
|
|
sudo apt-get update -qq && sudo apt-get install -y -qq jq
|
|
pip install ziglang --quiet
|
|
$HOME/.cargo/bin/cargo install cargo-zigbuild
|
|
$HOME/.cargo/bin/rustup target add x86_64-unknown-linux-musl
|
|
|
|
- name: Cache cargo registry
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
src/target
|
|
key: linux-musl-cargo-${{ hashFiles('src/Cargo.lock') }}
|
|
restore-keys: linux-musl-cargo-
|
|
|
|
- name: Build static binary
|
|
run: cargo zigbuild --release --target x86_64-unknown-linux-musl
|
|
|
|
- name: Prepare artifact
|
|
run: |
|
|
mkdir -p /tmp/dist
|
|
cp target/x86_64-unknown-linux-musl/release/obikmer /tmp/dist/obikmer-linux-x86_64
|
|
strip /tmp/dist/obikmer-linux-x86_64
|
|
|
|
- name: Create Gitea release and upload binary
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEATOKEN }}
|
|
TAG: ${{ github.ref_name }}
|
|
run: |
|
|
release_id=$(curl -s -X POST \
|
|
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\"}" | jq -r '.id')
|
|
curl -s -X POST \
|
|
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/$release_id/assets" \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-F "attachment=@/tmp/dist/obikmer-linux-x86_64"
|