Files
2026-10-04 20:12:06 +08:00

94 lines
3.9 KiB
YAML

name: Build Framely installer release
run-name: "${{ startsWith(github.ref, 'refs/tags/') && format('Release Framely Installer {0}', github.ref_name) || format('Build Framely Installer {0}', github.ref_name) }}"
on:
push:
tags: ['installer-v[0-9]*']
workflow_dispatch:
permissions:
contents: read
concurrency:
group: framely-installer-release-${{ github.ref }}
cancel-in-progress: false
jobs:
installer:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-24.04
platform: linux-x64
- os: ubuntu-24.04-arm
platform: linux-arm64
- os: windows-2022
platform: windows-x64
- os: macos-14
platform: macos-arm64
- os: macos-15-intel
platform: macos-x64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Cache Cargo dependencies and build artifacts
uses: Swatinem/rust-cache@v2
with:
shared-key: framely-installer-${{ matrix.platform }}
workspaces: "installer -> target"
cache-on-failure: true
- name: Linux dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y build-essential cmake pkg-config libssl-dev libfontconfig1-dev libfreetype6-dev libx11-dev libx11-xcb-dev libxcb1-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libxkbcommon-x11-dev libwayland-dev libvulkan-dev
- name: Check installer version
shell: bash
env:
RELEASE_REF: ${{ github.ref }}
RELEASE_TAG: ${{ github.ref_name }}
run: |
python3 - <<'PYTHON'
import os, tomllib
version = tomllib.load(open('installer/Cargo.toml', 'rb'))['package']['version']
if os.environ['RELEASE_REF'].startswith('refs/tags/'):
assert os.environ['RELEASE_TAG'] == 'installer-v' + version, 'Tag must match installer/Cargo.toml'
PYTHON
- name: Check, test and build installer
run: |
cargo test --manifest-path installer/Cargo.toml --locked --no-default-features --lib
cargo build --manifest-path installer/Cargo.toml --locked --release
- name: Package installer
env:
INSTALLER_PLATFORM: ${{ matrix.platform }}
run: python3 tools/package-installer.py
- uses: actions/upload-artifact@v4
with:
name: framely-installer-${{ matrix.platform }}
path: installer/dist/*
if-no-files-found: error
publish:
# Installer releases must never replace the latest Frame release.
if: startsWith(github.ref, 'refs/tags/installer-v')
needs: [installer]
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: framely-installer-*
merge-multiple: true
path: release-assets
- name: Generate installer checksums and publish
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
RELEASE_TAG: ${{ github.ref_name }}
run: |
cd release-assets
sha256sum -- *.tar.gz *.zip > SHA256SUMS
printf 'Framely Installer %s\n\nNative desktop installers for Linux, Windows and macOS. This version is independent of Framely on Frame.\n' "${RELEASE_TAG#installer-v}" > release-notes.txt
prerelease=false
version=${RELEASE_TAG#installer-v}
if [[ "$version" == *-* ]]; then prerelease=true; fi
gh release create "$RELEASE_TAG" --verify-tag --title "Framely Installer ${RELEASE_TAG#installer-v}" --notes-file release-notes.txt --draft --latest=false --prerelease="$prerelease"
gh release upload "$RELEASE_TAG" -- *.tar.gz *.zip SHA256SUMS
gh release edit "$RELEASE_TAG" --draft=false --latest=false --prerelease="$prerelease"