Build, test and release with cargo: CI, release workflow, cross-build and packaging scripts, Homebrew

This commit is contained in:
Andy Dixon
2026-10-08 19:54:56 +01:00
parent 507f635b49
commit ce8acf0ade
14 changed files with 335 additions and 118 deletions
+46
View File
@@ -0,0 +1,46 @@
# On a version tag: build every target, package, and publish a GitHub
# release whose notes are the tag's CHANGELOG.md section.
name: release
on:
push:
tags: ["v*"]
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
jobs:
build-cross:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v5
- uses: ./.github/actions/cross-tools
- run: TARGETS="linux/amd64 linux/arm64 linux/386 linux/arm linux/riscv64 windows/amd64 windows/arm64 freebsd/amd64 netbsd/amd64" scripts/build.sh
- uses: actions/upload-artifact@v4
with: {name: bin-cross, path: dist/mapsize-*}
build-macos:
runs-on: macos-15
steps:
- uses: actions/checkout@v5
- run: rustup target add x86_64-apple-darwin aarch64-apple-darwin
- run: TARGETS="darwin/amd64 darwin/arm64" scripts/build.sh
- uses: actions/upload-artifact@v4
with: {name: bin-macos, path: dist/mapsize-*}
publish:
needs: [build-cross, build-macos]
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v4
with: {path: dist, merge-multiple: true}
- run: scripts/release.sh "$GITHUB_REF_NAME" dist dist/release
- name: release
env:
GH_TOKEN: ${{ github.token }}
run: |
v=${GITHUB_REF_NAME#v}
awk -v h="## $v" 'index($0, h) == 1 {f=1; next} /^## /{f=0} f' CHANGELOG.md >notes.md
gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes-file notes.md dist/release/*