- bump version to 0.1.0; add crates.io metadata (include list, homepage, rust-version) - add .github/workflows/release.yml: on tag v* → publish to crates.io + GitHub Release with binaries - README: absolute links/images and badges so it renders on crates.io; add install section - CHANGELOG: 0.1.0
59 lines
1.9 KiB
YAML
59 lines
1.9 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
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
- uses: Swatinem/rust-cache@v2
|
|
- name: Publish to crates.io
|
|
# Requires a CARGO_REGISTRY_TOKEN repo secret (Settings → Secrets → Actions).
|
|
if: ${{ secrets.CARGO_REGISTRY_TOKEN != '' }}
|
|
run: cargo publish --token "${{ secrets.CARGO_REGISTRY_TOKEN }}"
|
|
|
|
# --- 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
|
|
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: |
|
|
staging="cortiq-gateway-${{ github.ref_name }}-${{ matrix.target }}"
|
|
mkdir "$staging"
|
|
cp "target/${{ matrix.target }}/release/cortiq-gateway" "$staging"/
|
|
cp README.md LICENSE config/gateway.example.toml "$staging"/
|
|
tar czf "$staging.tar.gz" "$staging"
|
|
echo "ASSET=$staging.tar.gz" >> "$GITHUB_ENV"
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: ${{ env.ASSET }}
|
|
generate_release_notes: true
|