616050075f
Add the `--break-system-packages` flag to the `pip install ziglang` command in the Gitea release workflow to bypass PEP 668 restrictions on modern Linux distributions. Additionally, bump the `obikmer` crate version from 1.1.9 to 1.1.11 across both Cargo.toml and Cargo.lock.
66 lines
2.5 KiB
YAML
66 lines
2.5 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 --break-system-packages
|
|
$HOME/.cargo/bin/cargo install cargo-zigbuild
|
|
$HOME/.cargo/bin/rustup target add x86_64-unknown-linux-musl
|
|
|
|
- name: Create musl C/C++ wrappers
|
|
run: |
|
|
ZIG=$(python3 -c "import ziglang, os; print(os.path.join(os.path.dirname(ziglang.__file__), 'zig'))")
|
|
printf '#!/bin/sh\nexec "%s" cc -target x86_64-linux-musl "$@"\n' "$ZIG" | sudo tee /usr/local/bin/x86_64-linux-musl-gcc > /dev/null
|
|
printf '#!/bin/sh\nexec "%s" c++ -target x86_64-linux-musl "$@"\n' "$ZIG" | sudo tee /usr/local/bin/x86_64-linux-musl-g++ > /dev/null
|
|
sudo chmod +x /usr/local/bin/x86_64-linux-musl-gcc /usr/local/bin/x86_64-linux-musl-g++
|
|
|
|
- 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"
|