stahl/.github/workflows/release.yml
dependabot[bot] f9feffd929
chore(deps): bump softprops/action-gh-release from 2 to 3
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2 to 3.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v2...v3)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-version: '3'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-08 11:42:31 +00:00

122 lines
3.9 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
# Each installer gets a checksum, which the in-app updater requires. It catches a corrupt
# download. It comes from the same release, so it can't catch a tampered one.
- 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
shasum -a 256 stahl-capital-macos-arm64.dmg > stahl-capital-macos-arm64.dmg.sha256
- name: build the Debian package
if: matrix.platform == 'ubuntu-latest'
run: |
cargo bundle --release --format deb
cp target/release/bundle/deb/*.deb .
for deb in *.deb; do sha256sum "$deb" > "$deb.sha256"; done
- 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
$hash = (Get-FileHash stahl-capital-windows-x64.zip -Algorithm SHA256).Hash.ToLower()
"$hash stahl-capital-windows-x64.zip" | Out-File -Encoding ascii stahl-capital-windows-x64.zip.sha256
- uses: actions/upload-artifact@v7
with:
name: installer-${{ matrix.platform }}
path: |
*.dmg
*.deb
*.zip
*.sha256
if-no-files-found: error
# One job after all the builds, so a failed build can't publish a release with installers missing.
# It runs on PRs too, so everything but the publishing itself is tested before a tag needs it.
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- name: check the tag matches Cargo.toml
if: startsWith(github.ref, 'refs/tags/')
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@v8
with:
pattern: installer-*
path: installers
merge-multiple: true
- name: check every installer is there
run: |
ls -l installers
ls installers/*.dmg installers/*.deb installers/*.zip
- uses: softprops/action-gh-release@v3
if: startsWith(github.ref, 'refs/tags/')
with:
name: "Stahl Capital ${{ github.ref_name }}"
generate_release_notes: true
fail_on_unmatched_files: true
files: installers/*