mirror of
https://github.com/orbien-org/orbien.git
synced 2026-09-22 08:01:32 +00:00
411 lines
12 KiB
YAML
411 lines
12 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
workflow_dispatch:
|
|
inputs:
|
|
version:
|
|
description: "Release version"
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
RUST_VERSION: "1.92"
|
|
|
|
jobs:
|
|
meta:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
version: ${{ steps.ver.outputs.version }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Resolve version
|
|
id: ver
|
|
env:
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
INPUT_VERSION: ${{ inputs.version }}
|
|
run: |
|
|
set -euo pipefail
|
|
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
|
|
V="$INPUT_VERSION"
|
|
else
|
|
V="${GITHUB_REF_NAME#v}"
|
|
fi
|
|
if [ -z "$V" ]; then
|
|
echo "version is empty" >&2
|
|
exit 1
|
|
fi
|
|
CARGO_V="$(python3 -c "import tomllib; print(tomllib.load(open('Cargo.toml','rb'))['workspace']['package']['version'])")"
|
|
if [ "$CARGO_V" != "$V" ]; then
|
|
echo "version mismatch: release=$V workspace=$CARGO_V" >&2
|
|
echo "update [workspace.package] version in Cargo.toml before tagging/releasing" >&2
|
|
exit 1
|
|
fi
|
|
echo "version=$V" >> "$GITHUB_OUTPUT"
|
|
echo "Release version: $V (matches Cargo workspace)"
|
|
|
|
build-cli:
|
|
needs: meta
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
goos: linux
|
|
goarch: amd64
|
|
libc: gnu
|
|
- os: ubuntu-latest
|
|
target: x86_64-unknown-linux-musl
|
|
goos: linux
|
|
goarch: amd64
|
|
libc: musl
|
|
- os: ubuntu-24.04-arm
|
|
target: aarch64-unknown-linux-gnu
|
|
goos: linux
|
|
goarch: arm64
|
|
libc: gnu
|
|
- os: ubuntu-24.04-arm
|
|
target: aarch64-unknown-linux-musl
|
|
goos: linux
|
|
goarch: arm64
|
|
libc: musl
|
|
- os: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
goos: windows
|
|
goarch: amd64
|
|
- os: windows-11-arm
|
|
target: aarch64-pc-windows-msvc
|
|
goos: windows
|
|
goarch: arm64
|
|
- os: macos-15-intel
|
|
target: x86_64-apple-darwin
|
|
goos: darwin
|
|
goarch: amd64
|
|
- os: macos-14
|
|
target: aarch64-apple-darwin
|
|
goos: darwin
|
|
goarch: arm64
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: npm
|
|
cache-dependency-path: server-ui/package-lock.json
|
|
|
|
- name: Build server-ui
|
|
working-directory: server-ui
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Install musl toolchain
|
|
if: endsWith(matrix.target, '-musl')
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y musl-tools
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ env.RUST_VERSION }}
|
|
targets: ${{ matrix.target }}
|
|
|
|
- name: Cache Cargo
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: cli-${{ matrix.target }}
|
|
|
|
- name: Build orbien-server + orbien
|
|
shell: bash
|
|
env:
|
|
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: musl-gcc
|
|
run: |
|
|
cargo build --release --locked \
|
|
-p orbien-server -p orbien-client \
|
|
--target ${{ matrix.target }}
|
|
|
|
- name: Package tarballs
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
chmod +x scripts/pack-release.sh
|
|
VERSION="${{ needs.meta.outputs.version }}"
|
|
TARGET="${{ matrix.target }}"
|
|
OUT="dist/release"
|
|
EXT=""
|
|
if [[ "${{ matrix.goos }}" == "windows" ]]; then
|
|
EXT=".exe"
|
|
fi
|
|
BIN_DIR="target/${TARGET}/release"
|
|
LIBC="${{ matrix.libc }}"
|
|
|
|
pack_one() {
|
|
local name="$1"
|
|
local bin="$2"
|
|
local conf="$3"
|
|
if [[ -n "$LIBC" ]]; then
|
|
./scripts/pack-release.sh \
|
|
--name "$name" \
|
|
--version "$VERSION" \
|
|
--os "${{ matrix.goos }}" \
|
|
--arch "${{ matrix.goarch }}" \
|
|
--libc "$LIBC" \
|
|
--outdir "$OUT" \
|
|
--bin "$bin" \
|
|
--config "$conf"
|
|
else
|
|
./scripts/pack-release.sh \
|
|
--name "$name" \
|
|
--version "$VERSION" \
|
|
--os "${{ matrix.goos }}" \
|
|
--arch "${{ matrix.goarch }}" \
|
|
--outdir "$OUT" \
|
|
--bin "$bin" \
|
|
--config "$conf"
|
|
fi
|
|
}
|
|
|
|
pack_one orbien-server \
|
|
"${BIN_DIR}/orbien-server${EXT}" \
|
|
conf/orbien-server.toml
|
|
pack_one orbien \
|
|
"${BIN_DIR}/orbien${EXT}" \
|
|
conf/orbien.toml
|
|
|
|
- name: Upload CLI artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: cli-${{ matrix.target }}
|
|
path: dist/release/*.tar.gz
|
|
if-no-files-found: error
|
|
|
|
build-cli-freebsd:
|
|
needs: meta
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: npm
|
|
cache-dependency-path: server-ui/package-lock.json
|
|
|
|
- name: Build server-ui
|
|
working-directory: server-ui
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Build & pack CLI on FreeBSD
|
|
uses: vmactions/freebsd-vm@v1
|
|
with:
|
|
release: "14"
|
|
arch: x86_64
|
|
mem: 8192
|
|
usesh: true
|
|
sync: rsync
|
|
copyback: true
|
|
envs: "RUST_VERSION VERSION"
|
|
prepare: |
|
|
set -e
|
|
pkg install -y bash curl git gmake pkgconf ca_root_nss
|
|
export PATH="$HOME/.cargo/bin:/usr/local/bin:$PATH"
|
|
if [ ! -x "$HOME/.cargo/bin/cargo" ]; then
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
|
|
| sh -s -- -y --profile minimal --default-toolchain "${RUST_VERSION}"
|
|
fi
|
|
. "$HOME/.cargo/env"
|
|
rustup default "${RUST_VERSION}"
|
|
run: |
|
|
set -euo pipefail
|
|
export PATH="$HOME/.cargo/bin:/usr/local/bin:$PATH"
|
|
if [ -f "$HOME/.cargo/env" ]; then
|
|
. "$HOME/.cargo/env"
|
|
fi
|
|
|
|
cargo build --release --locked -p orbien-server -p orbien-client
|
|
./target/release/orbien-server --help >/dev/null
|
|
./target/release/orbien --help >/dev/null
|
|
|
|
OUT="dist/release"
|
|
mkdir -p "$OUT"
|
|
bash scripts/pack-release.sh \
|
|
--name orbien-server \
|
|
--version "$VERSION" \
|
|
--os freebsd \
|
|
--arch amd64 \
|
|
--outdir "$OUT" \
|
|
--bin target/release/orbien-server \
|
|
--config conf/orbien-server.toml
|
|
bash scripts/pack-release.sh \
|
|
--name orbien \
|
|
--version "$VERSION" \
|
|
--os freebsd \
|
|
--arch amd64 \
|
|
--outdir "$OUT" \
|
|
--bin target/release/orbien \
|
|
--config conf/orbien.toml
|
|
ls -lh "$OUT"
|
|
env:
|
|
RUST_VERSION: ${{ env.RUST_VERSION }}
|
|
VERSION: ${{ needs.meta.outputs.version }}
|
|
|
|
- name: Upload FreeBSD CLI artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: cli-freebsd-amd64
|
|
path: dist/release/*.tar.gz
|
|
if-no-files-found: error
|
|
|
|
build-desktop:
|
|
needs: meta
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
goos: linux
|
|
goarch: amd64
|
|
artifact: deb
|
|
- os: ubuntu-24.04-arm
|
|
goos: linux
|
|
goarch: arm64
|
|
artifact: deb
|
|
- os: windows-latest
|
|
goos: windows
|
|
goarch: amd64
|
|
artifact: windows
|
|
- os: windows-11-arm
|
|
goos: windows
|
|
goarch: arm64
|
|
artifact: windows
|
|
- os: macos-15-intel
|
|
goos: darwin
|
|
goarch: amd64
|
|
artifact: dmg
|
|
- os: macos-14
|
|
goos: darwin
|
|
goarch: arm64
|
|
artifact: dmg
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@master
|
|
with:
|
|
toolchain: ${{ env.RUST_VERSION }}
|
|
|
|
- name: Cache Cargo
|
|
uses: Swatinem/rust-cache@v2
|
|
with:
|
|
key: desktop-${{ matrix.os }}-${{ matrix.goarch }}
|
|
|
|
- name: Install Linux GUI deps
|
|
if: matrix.artifact == 'deb'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
|
|
libxkbcommon-dev libwayland-dev libegl1-mesa-dev \
|
|
libfontconfig1-dev
|
|
|
|
- name: Build orbien-desktop
|
|
shell: bash
|
|
run: cargo build --release --locked -p orbien-desktop
|
|
|
|
- name: Package macOS DMG
|
|
if: matrix.artifact == 'dmg'
|
|
shell: bash
|
|
run: |
|
|
chmod +x scripts/pack-desktop-macos.sh
|
|
./scripts/pack-desktop-macos.sh \
|
|
--version "${{ needs.meta.outputs.version }}" \
|
|
--arch "${{ matrix.goarch }}" \
|
|
--outdir dist/desktop
|
|
|
|
- name: Package Windows EXE + ZIP
|
|
if: matrix.artifact == 'windows'
|
|
shell: bash
|
|
run: |
|
|
chmod +x scripts/pack-desktop-windows.sh
|
|
./scripts/pack-desktop-windows.sh \
|
|
--bin target/release/orbien-desktop.exe \
|
|
--version "${{ needs.meta.outputs.version }}" \
|
|
--arch "${{ matrix.goarch }}" \
|
|
--outdir dist/desktop
|
|
|
|
- name: Package Linux DEB
|
|
if: matrix.artifact == 'deb'
|
|
shell: bash
|
|
run: |
|
|
chmod +x scripts/pack-desktop-linux-deb.sh
|
|
./scripts/pack-desktop-linux-deb.sh \
|
|
--version "${{ needs.meta.outputs.version }}" \
|
|
--arch "${{ matrix.goarch }}" \
|
|
--outdir dist/desktop
|
|
|
|
- name: Upload desktop artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: desktop-${{ matrix.goos }}-${{ matrix.goarch }}
|
|
path: |
|
|
dist/desktop/*.dmg
|
|
dist/desktop/*.zip
|
|
dist/desktop/*.exe
|
|
dist/desktop/*.deb
|
|
if-no-files-found: error
|
|
|
|
publish:
|
|
needs: [meta, build-cli, build-cli-freebsd, build-desktop]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
pattern: "*"
|
|
merge-multiple: true
|
|
|
|
- name: List artifacts
|
|
run: find artifacts -type f | sort
|
|
|
|
- name: Create / update GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: v${{ needs.meta.outputs.version }}
|
|
name: v${{ needs.meta.outputs.version }}
|
|
draft: false
|
|
prerelease: ${{ contains(needs.meta.outputs.version, '-') }}
|
|
generate_release_notes: true
|
|
files: |
|
|
artifacts/*.tar.gz
|
|
artifacts/*.dmg
|
|
artifacts/*.zip
|
|
artifacts/*.exe
|
|
artifacts/*.deb
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|