Skip to content

Close remaining BUGHUNTERCLAUDE findings: type safety, security, CI, … #114

Close remaining BUGHUNTERCLAUDE findings: type safety, security, CI, …

Close remaining BUGHUNTERCLAUDE findings: type safety, security, CI, … #114

Workflow file for this run

name: Build & Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g. v2.1.3-beta)'
required: true
default: 'v2.3.0'
jobs:
verify:
runs-on: ubuntu-latest
steps:
# Pin to latest stable — verify at https://github.com/actions/checkout/releases if builds break
- uses: actions/checkout@v6
# Pin to latest stable — verify at https://github.com/actions/setup-node/releases if builds break
- uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
- run: npm ci
- name: Verify renderer types
run: npm run lint
- name: Verify Electron types
run: npx tsc -p electron/tsconfig.json --noEmit
- name: Run tests
run: npm test
- name: Build application bundles
run: npm run build
build-linux:
needs: verify
runs-on: ubuntu-latest
steps:
# Pin to latest stable — verify at https://github.com/actions/checkout/releases if builds break
- uses: actions/checkout@v6
# Pin to latest stable — verify at https://github.com/actions/setup-node/releases if builds break
- uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
- run: npm ci
- name: Install Linux build dependencies
run: sudo apt-get install -y rpm fakeroot dpkg
- name: Build application bundles
run: npm run build
- name: Package Linux targets
run: npx electron-builder --linux AppImage deb --x64 --publish never
# Pin to latest stable — verify at https://github.com/actions/upload-artifact/releases if builds break
- uses: actions/upload-artifact@v7
with:
name: linux-packages
path: |
release/*.AppImage
release/*.deb
build-macos:
needs: verify
runs-on: macos-latest
steps:
# Pin to latest stable — verify at https://github.com/actions/checkout/releases if builds break
- uses: actions/checkout@v6
# Pin to latest stable — verify at https://github.com/actions/setup-node/releases if builds break
- uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
- run: npm ci
- name: Build application bundles
run: npm run build
- name: Package macOS
run: npx electron-builder --mac dmg --publish never
# Pin to latest stable — verify at https://github.com/actions/upload-artifact/releases if builds break
- uses: actions/upload-artifact@v7
with:
name: macos-installer
path: release/*.dmg
build-windows:
needs: verify
runs-on: windows-latest
steps:
# Pin to latest stable — verify at https://github.com/actions/checkout/releases if builds break
- uses: actions/checkout@v6
# Pin to latest stable — verify at https://github.com/actions/setup-node/releases if builds break
- uses: actions/setup-node@v6
with:
node-version: 20
cache: npm
- run: npm ci
- name: Build application bundles
run: npm run build
- name: Package Windows
run: npx electron-builder --win nsis --x64 --publish never
# Pin to latest stable — verify at https://github.com/actions/upload-artifact/releases if builds break
- uses: actions/upload-artifact@v7
with:
name: windows-installer
path: release/*.exe
publish-release:
needs: [build-linux, build-macos, build-windows]
if: needs.build-linux.result == 'success' && needs.build-macos.result == 'success' && needs.build-windows.result == 'success'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# Pin to latest stable — verify at https://github.com/actions/download-artifact/releases if builds break
- uses: actions/download-artifact@v8
with:
path: release-artifacts
merge-multiple: true
- name: Resolve tag name
id: tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "name=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${{ steps.tag.outputs.name }}"
mapfile -t files < <(find release-artifacts -type f | sort)
if [ "${#files[@]}" -eq 0 ]; then
echo "No release artifacts found."
exit 1
fi
# --clobber replaces an existing release atomically (no delete+create race)
gh release create "$tag" "${files[@]}" \
--repo "$GITHUB_REPOSITORY" \
--title "$tag" \
--latest \
--clobber