162 lines
5.8 KiB
YAML
162 lines
5.8 KiB
YAML
name: Native release
|
|
|
|
on:
|
|
push:
|
|
tags: ['v*'] # publish.py enforces exactly vX.Y.Z == Cargo.toml.
|
|
|
|
# Requires Gitea >=1.26.2; check it before any artifact transfer. Never cancel
|
|
# an in-flight publisher. Other publishers for this tag must use the same group.
|
|
concurrency:
|
|
group: release-${{ gitea.repository }}-${{ gitea.ref }}
|
|
cancel-in-progress: false
|
|
|
|
permissions:
|
|
code: read
|
|
|
|
env:
|
|
GITEA_API_URL: ${{ gitea.api_url }}
|
|
GITEA_REPOSITORY: ${{ gitea.repository }}
|
|
RELEASE_TAG: ${{ gitea.ref_name }}
|
|
RELEASE_COMMIT: ${{ gitea.sha }}
|
|
RUSTUP_TOOLCHAIN: nightly-2026-11-24
|
|
CARGO_INCREMENTAL: '0'
|
|
|
|
jobs:
|
|
linux:
|
|
# Host/image prerequisites: Git, Bash, Node 20, Python 3.11+,
|
|
# and root or passwordless sudo for the explicit apt packages below.
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
ref: ${{ gitea.sha }}
|
|
persist-credentials: false
|
|
|
|
- name: Check tag, checkout and Gitea prerequisite
|
|
run: python3 packaging/publish.py check
|
|
|
|
- name: Prepare native Linux build
|
|
id: stage
|
|
run: |
|
|
set -euo pipefail
|
|
. /etc/os-release
|
|
[[ "$ID" == ubuntu && "$VERSION_ID" == 24.04 ]]
|
|
test "$(uname -m)" = x86_64
|
|
sudo_cmd=()
|
|
if [ "$(id -u)" -ne 0 ]; then sudo_cmd=(sudo); fi
|
|
"${sudo_cmd[@]}" apt-get update
|
|
"${sudo_cmd[@]}" apt-get install -y ca-certificates curl build-essential cmake perl nasm pkg-config libcurl4-openssl-dev dpkg-dev
|
|
dist=$(mktemp -d "$RUNNER_TEMP/release-linux.XXXXXXXX")
|
|
build=$(mktemp -d "$RUNNER_TEMP/build-linux.XXXXXXXX")
|
|
echo "dist=$dist" >> "$GITHUB_OUTPUT"
|
|
echo "CARGO_TARGET_DIR=$build" >> "$GITHUB_ENV"
|
|
|
|
- uses: https://github.com/dtolnay/rust-toolchain@df2a88e9fe4098bad09cb42c3dec7187f15861fc
|
|
with:
|
|
toolchain: ${{ env.RUSTUP_TOOLCHAIN }}
|
|
targets: x86_64-unknown-linux-gnu
|
|
|
|
- name: Build and package Linux
|
|
env:
|
|
DIST: ${{ steps.stage.outputs.dist }}
|
|
run: |
|
|
set -euo pipefail
|
|
cargo build --locked --release --target x86_64-unknown-linux-gnu --features vendored-lua
|
|
binary="$CARGO_TARGET_DIR/x86_64-unknown-linux-gnu/release/rusty-path-of-building"
|
|
"$binary" --version
|
|
python3 packaging/package.py linux "$binary" --output "$DIST"
|
|
python3 packaging/publish.py check --assets "$DIST" --platform linux
|
|
|
|
# Gitea's v4 protocol needs these compatible forks (Gitea 1.22 release notes).
|
|
# Runtime artifact credentials are supplied by the runner, not GITEA_TOKEN.
|
|
- uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7 # v4
|
|
with:
|
|
name: packages-linux
|
|
path: ${{ steps.stage.outputs.dist }}/*
|
|
if-no-files-found: error
|
|
compression-level: 0
|
|
overwrite: true
|
|
|
|
windows:
|
|
# Same MSVC build and packaged-executable checks as the Windows job on main.
|
|
runs-on: windows-x64
|
|
defaults:
|
|
run:
|
|
shell: powershell
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
ref: ${{ gitea.sha }}
|
|
persist-credentials: false
|
|
|
|
- name: Check tag, checkout and Gitea prerequisite
|
|
run: |
|
|
python packaging/publish.py check
|
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
|
|
- uses: https://github.com/dtolnay/rust-toolchain@df2a88e9fe4098bad09cb42c3dec7187f15861fc
|
|
with:
|
|
toolchain: ${{ env.RUSTUP_TOOLCHAIN }}
|
|
targets: x86_64-pc-windows-msvc
|
|
|
|
- name: Build and package Windows
|
|
id: stage
|
|
run: |
|
|
$ErrorActionPreference = 'Stop'
|
|
$dist = Join-Path $env:RUNNER_TEMP ('release-windows-' + [guid]::NewGuid())
|
|
New-Item -ItemType Directory -Path $dist | Out-Null
|
|
& .\packaging\windows\build.ps1 -OutputDirectory $dist
|
|
python packaging/publish.py check --assets $dist --platform windows
|
|
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
|
[IO.File]::AppendAllText($env:GITHUB_OUTPUT, "dist=$dist" + [Environment]::NewLine)
|
|
|
|
- uses: https://github.com/ChristopherHX/gitea-upload-artifact@81f940d004763f986ba3582c007fd842dd5cb0d7 # v4
|
|
with:
|
|
name: packages-windows
|
|
path: ${{ steps.stage.outputs.dist }}/*
|
|
if-no-files-found: error
|
|
compression-level: 0
|
|
overwrite: true
|
|
|
|
publish:
|
|
needs: [linux, windows]
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
code: read
|
|
releases: write
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- uses: https://github.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
ref: ${{ gitea.sha }}
|
|
persist-credentials: false
|
|
|
|
- name: Check prerequisites and prepare empty download directory
|
|
id: stage
|
|
run: |
|
|
set -euo pipefail
|
|
python3 packaging/publish.py check
|
|
dist=$(mktemp -d "$RUNNER_TEMP/release-publish.XXXXXXXX")
|
|
echo "dist=$dist" >> "$GITHUB_OUTPUT"
|
|
|
|
- uses: https://github.com/ChristopherHX/gitea-download-artifact@75635f32b4c1c41c4b3d64e8f85210112ed4c9c7 # v4
|
|
with:
|
|
name: packages-linux
|
|
path: ${{ steps.stage.outputs.dist }}
|
|
|
|
- uses: https://github.com/ChristopherHX/gitea-download-artifact@75635f32b4c1c41c4b3d64e8f85210112ed4c9c7 # v4
|
|
with:
|
|
name: packages-windows
|
|
path: ${{ steps.stage.outputs.dist }}
|
|
|
|
- name: Publish verified four-attachment release
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
DIST: ${{ steps.stage.outputs.dist }}
|
|
run: python3 packaging/publish.py publish --assets "$DIST"
|