87 lines
2 KiB
YAML
87 lines
2 KiB
YAML
name: release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags:
|
|
- "v[0-9]+.[0-9]+.[0-9]+"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
create_release:
|
|
name: Create release
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Get the release version
|
|
if: env.VERSION == ''
|
|
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
|
|
|
|
- name: Show the version
|
|
run: |
|
|
echo "version is: $VERSION"
|
|
|
|
- name: Check that tag version and Cargo.toml version are the same
|
|
shell: bash
|
|
run: |
|
|
if ! grep -q "version = \"$VERSION\"" Cargo.toml; then
|
|
echo "version does not match Cargo.toml" >&2
|
|
exit 1
|
|
fi
|
|
|
|
- name: Create GitHub release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: gh release create $VERSION --draft --verify-tag --title $VERSION
|
|
|
|
outputs:
|
|
version: ${{ env.VERSION }}
|
|
|
|
build_release:
|
|
name: Build all the stuff
|
|
needs: ['create_release'] # We need to know the upload URL
|
|
runs-on: ${{ matrix.os }} # We run many different builds
|
|
env:
|
|
# Emit backtraces on panics.
|
|
RUST_BACKTRACE: 1
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
build: ['linux', 'macos', 'arm-macos', 'windows']
|
|
include:
|
|
- build: linux
|
|
os: ubuntu-22.04
|
|
target: x86_64-unknown-linux-musl
|
|
|
|
- build: macos
|
|
os: macos-latest
|
|
target: x86_64-apple-darwin
|
|
|
|
- build: arm-macos
|
|
os: macos-latest
|
|
target: aarch64-apple-darwin
|
|
|
|
- build: windows
|
|
os: windows-2022
|
|
target: x86_64-pc-windows-msvc
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
target: ${{ matrix.target }}
|
|
|
|
- name: Run the release automation
|
|
shell: bash
|
|
env:
|
|
RELEASE_TAG: ${{ needs.create_release.outputs.version }}
|
|
BUILD: ${{ matrix.build }}
|
|
run: python3 release.py
|