Release / crates-io (push) Canceled after 0s
Release / release (macos-14, aarch64-apple-darwin) (push) Canceled after 0s
Release / release (ubuntu-latest, x86_64-unknown-linux-gnu) (push) Canceled after 0s
Release / release (windows-latest, x86_64-pc-windows-msvc) (push) Canceled after 0s
- release.yml: add x86_64-pc-windows-msvc target, OS-aware packaging (.exe + .zip) - ci.yml: split into lint (fmt/clippy) + test matrix (ubuntu/windows/macos) - use getrandom for the admin/key token CSPRNG (secure on Windows too) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
70 lines
2.2 KiB
YAML
70 lines
2.2 KiB
YAML
name: Release
|
|
|
|
# Triggered when a version tag is pushed, e.g. `git tag v0.1.0 && git push --tags`.
|
|
# Publishes the crate to crates.io and creates a GitHub Release with prebuilt binaries.
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
# --- publish to crates.io -------------------------------------------------
|
|
crates-io:
|
|
runs-on: ubuntu-latest
|
|
# Requires a CARGO_REGISTRY_TOKEN repo secret (Settings → Secrets → Actions).
|
|
env:
|
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Publish to crates.io
|
|
if: ${{ env.CARGO_REGISTRY_TOKEN != '' }}
|
|
run: cargo publish
|
|
|
|
# --- prebuilt binaries + GitHub Release -----------------------------------
|
|
release:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
target: x86_64-unknown-linux-gnu
|
|
- os: macos-14
|
|
target: aarch64-apple-darwin
|
|
- os: windows-latest
|
|
target: x86_64-pc-windows-msvc
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Build
|
|
run: cargo build --release --target ${{ matrix.target }}
|
|
- name: Package
|
|
shell: bash
|
|
run: |
|
|
bin=cortiq-gateway
|
|
[ "${{ runner.os }}" = "Windows" ] && bin=cortiq-gateway.exe
|
|
staging="cortiq-gateway-${{ github.ref_name }}-${{ matrix.target }}"
|
|
mkdir "$staging"
|
|
cp "target/${{ matrix.target }}/release/$bin" "$staging"/
|
|
cp README.md LICENSE config/gateway.example.toml "$staging"/
|
|
if [ "${{ runner.os }}" = "Windows" ]; then
|
|
7z a "$staging.zip" "$staging" >/dev/null
|
|
echo "ASSET=$staging.zip" >> "$GITHUB_ENV"
|
|
else
|
|
tar czf "$staging.tar.gz" "$staging"
|
|
echo "ASSET=$staging.tar.gz" >> "$GITHUB_ENV"
|
|
fi
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: ${{ env.ASSET }}
|
|
generate_release_notes: true
|