Skip to content

Release

Release #9

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
release-mac:
strategy:
fail-fast: false
matrix:
include:
- arch: arm64
runner: macos-14
dist_command: pnpm dist:mac:arm64
artifact_name: release-mac-arm64
- arch: x64
runner: macos-15-intel
dist_command: pnpm dist:mac:x64
artifact_name: release-mac-x64
continue-on-error: ${{ matrix.arch == 'x64' }}
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Setup Python for node-gyp
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Validate semantic version tag
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG="${GITHUB_REF_NAME}"
if [[ ! "$TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$ ]]; then
echo "Tag '$TAG' is not valid SemVer (expected vMAJOR.MINOR.PATCH[-PRERELEASE][+BUILD])."
exit 1
fi
- name: Set version from tag
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION="${GITHUB_REF#refs/tags/v}"
pnpm pkg set version="$VERSION"
- name: Prepare package manifest for electron-builder
shell: bash
run: |
pnpm pkg delete dependencies.electron
pnpm pkg set devDependencies.electron="~40.3.0"
- name: Build app (macOS ${{ matrix.arch }})
run: pnpm build
- name: Verify packaged inputs (macOS ${{ matrix.arch }})
run: |
test -f dist-electron/main/index.cjs
test -f dist-electron/preload/index.cjs
test -f out/renderer/index.html
- name: Package (macOS ${{ matrix.arch }})
env:
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
run: ${{ matrix.dist_command }}
- name: Upload package artifacts (macOS ${{ matrix.arch }})
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: release/**
if-no-files-found: error
release-win:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Setup Python for node-gyp
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Validate semantic version tag
if: startsWith(github.ref, 'refs/tags/')
shell: bash
run: |
TAG="${GITHUB_REF_NAME}"
if [[ ! "$TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$ ]]; then
echo "Tag '$TAG' is not valid SemVer (expected vMAJOR.MINOR.PATCH[-PRERELEASE][+BUILD])."
exit 1
fi
- name: Set version from tag
if: startsWith(github.ref, 'refs/tags/v')
shell: bash
run: |
VERSION="${GITHUB_REF#refs/tags/v}"
pnpm pkg set version="$VERSION"
- name: Prepare package manifest for electron-builder
shell: bash
run: |
pnpm pkg delete dependencies.electron
pnpm pkg set devDependencies.electron="~40.3.0"
- name: Build app (Windows)
run: pnpm build
- name: Verify packaged inputs (Windows)
shell: bash
run: |
test -f dist-electron/main/index.cjs
test -f dist-electron/preload/index.cjs
test -f out/renderer/index.html
- name: Package (Windows)
run: pnpm dist:win
- name: Upload package artifacts (Windows)
uses: actions/upload-artifact@v4
with:
name: release-win
path: release/**
if-no-files-found: error
release-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Setup Python for node-gyp
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install Linux packaging dependencies
run: |
sudo apt-get update
sudo apt-get install -y libarchive-tools rpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Validate semantic version tag
if: startsWith(github.ref, 'refs/tags/')
run: |
TAG="${GITHUB_REF_NAME}"
if [[ ! "$TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?$ ]]; then
echo "Tag '$TAG' is not valid SemVer (expected vMAJOR.MINOR.PATCH[-PRERELEASE][+BUILD])."
exit 1
fi
- name: Set version from tag
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION="${GITHUB_REF#refs/tags/v}"
pnpm pkg set version="$VERSION"
- name: Prepare package manifest for electron-builder
shell: bash
run: |
pnpm pkg delete dependencies.electron
pnpm pkg set devDependencies.electron="~40.3.0"
- name: Build app (Linux)
run: pnpm build
- name: Verify packaged inputs (Linux)
run: |
test -f dist-electron/main/index.cjs
test -f dist-electron/preload/index.cjs
test -f out/renderer/index.html
- name: Package (Linux)
run: pnpm dist:linux
- name: Upload package artifacts (Linux)
uses: actions/upload-artifact@v4
with:
name: release-linux
path: release/**
if-no-files-found: error
publish-release:
needs: [release-mac, release-win, release-linux]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Download all package artifacts
uses: actions/download-artifact@v4
with:
pattern: release-*
path: release-artifacts
merge-multiple: true
- name: Publish GitHub release assets
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${GITHUB_REF_NAME}"
if ! gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --title "$TAG" --generate-notes
fi
uploaded=0
while IFS= read -r -d '' file; do
base="$(basename "$file")"
case "$base" in
*.dmg|*.zip|*.msi|*.AppImage|*.deb|*.rpm|*.snap|*.nupkg|*.blockmap|latest*.yml|latest*.yaml|latest*.json)
if [[ "$base" == "builder-debug.yml" || "$base" == "builder-effective-config.yaml" ]]; then
continue
fi
gh release upload "$TAG" "$file" --repo "$GITHUB_REPOSITORY" --clobber
uploaded=$((uploaded + 1))
;;
*.exe)
if [[ "$base" != *Setup*.exe ]]; then
continue
fi
gh release upload "$TAG" "$file" --repo "$GITHUB_REPOSITORY" --clobber
uploaded=$((uploaded + 1))
;;
esac
done < <(find release-artifacts -type f -print0)
if [[ "$uploaded" -eq 0 ]]; then
echo "No distributable release assets found in release-artifacts/"
find release-artifacts -type f -print
exit 1
fi