stahl/.github/workflows/release.yml
Markus Zoppelt cb0bbd73a9
ci: publish releases from version tags and set the version to 0.2.0 (#50)
A tag like v0.2.0 now publishes a GitHub Release after all three builds pass, with no draft step. The version is 0.2.0 because 0.3.0 only distinguished the Rune branch from the GPUI one, which never shipped.
2026-11-06 18:42:58 +01:00

108 lines
3.1 KiB
YAML

name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
# Build the installers when something they depend on changes. Only a tag publishes anything.
pull_request:
paths:
- .github/workflows/release.yml
- Cargo.toml
- Cargo.lock
- assets/icons/**
permissions:
contents: read
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest # Apple Silicon
- platform: ubuntu-latest
- platform: windows-latest
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v7
- name: install Linux system dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libxkbcommon-dev libwayland-dev
# rustup reads the version from rust-toolchain.toml.
- name: install the Rust toolchain
run: rustup show active-toolchain || rustup toolchain install
- uses: Swatinem/rust-cache@v2
- name: install cargo-bundle
if: matrix.platform != 'windows-latest'
run: cargo install cargo-bundle --locked
- name: build the macOS disk image
if: matrix.platform == 'macos-latest'
run: |
cargo bundle --release
app="target/release/bundle/osx/Stahl Capital.app"
codesign --force --deep --sign - "$app"
hdiutil create -volname "Stahl Capital" -srcfolder "$app" -ov -format UDZO stahl-capital-macos-arm64.dmg
- name: build the Debian package
if: matrix.platform == 'ubuntu-latest'
run: |
cargo bundle --release --format deb
cp target/release/bundle/deb/*.deb .
- name: build the Windows archive
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
cargo build --release
Compress-Archive -Path target/release/stahl.exe -DestinationPath stahl-capital-windows-x64.zip
- uses: actions/upload-artifact@v4
with:
name: installer-${{ matrix.platform }}
path: |
*.dmg
*.deb
*.zip
if-no-files-found: error
# One job after all the builds, so a failed build can't publish a release with installers missing.
release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- name: check the tag matches Cargo.toml
run: |
version=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)
if [ "$GITHUB_REF_NAME" != "v$version" ]; then
echo "::error::tag $GITHUB_REF_NAME doesn't match version $version in Cargo.toml"
exit 1
fi
- uses: actions/download-artifact@v4
with:
pattern: installer-*
path: installers
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
name: "Stahl Capital ${{ github.ref_name }}"
generate_release_notes: true
fail_on_unmatched_files: true
files: installers/*