Add GitHub Actions workflows for CI/CD and releases

- Add build.yml workflow for continuous integration
  - Builds web app on Ubuntu
  - Packages Electron app for Windows, macOS, and Linux
  - Uploads artifacts for each platform

- Add release.yml workflow with release-drafter integration
  - Automatically creates draft releases on push to main
  - Auto-calculates version based on PR labels (major/minor/patch)
  - Updates package.json version during build for proper installers
  - Uploads platform-specific installers to draft releases

- Add release-drafter.yml configuration
  - Organizes changelog by categories (Features, Bug Fixes, Maintenance)
  - Supports semantic versioning via PR labels

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Jan-Henrik 2025-12-07 22:49:36 +01:00
parent f80cabc5f2
commit 17d7fb6b12
3 changed files with 229 additions and 0 deletions

43
.github/release-drafter.yml vendored Normal file
View file

@ -0,0 +1,43 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'dependencies'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- 'major'
- 'breaking'
minor:
labels:
- 'minor'
- 'feature'
patch:
labels:
- 'patch'
- 'fix'
- 'bugfix'
default: patch
template: |
## Changes
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION

92
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,92 @@
name: Build and Package
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build-web:
name: Build Web Application
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build web application
run: npm run build
- name: Upload web build artifacts
uses: actions/upload-artifact@v4
with:
name: web-build
path: dist/
retention-days: 7
build-electron:
name: Build Electron - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Package Electron app
run: npm run package
- name: Create distributables
run: npm run make
- name: Upload Windows artifacts
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: electron-windows
path: |
out/make/squirrel.windows/**/*.exe
out/make/squirrel.windows/**/*.nupkg
retention-days: 30
- name: Upload macOS artifacts
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: electron-macos
path: |
out/make/zip/**/*.zip
retention-days: 30
- name: Upload Linux artifacts
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: electron-linux
path: |
out/make/deb/**/*.deb
out/make/rpm/**/*.rpm
retention-days: 30

94
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,94 @@
name: Release
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
draft-release:
name: Draft Release
runs-on: ubuntu-latest
outputs:
release-id: ${{ steps.drafter.outputs.id }}
tag-name: ${{ steps.drafter.outputs.tag_name }}
version: ${{ steps.drafter.outputs.resolved_version }}
steps:
- name: Draft release
id: drafter
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-release:
name: Build Release - ${{ matrix.os }}
needs: draft-release
if: needs.draft-release.outputs.tag-name != ''
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Update package.json version
run: |
npm version ${{ needs.draft-release.outputs.version }} --no-git-tag-version
- name: Install dependencies
run: npm ci
- name: Package and make
run: npm run make
- name: Upload Windows release assets
if: matrix.os == 'windows-latest'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: https://uploads.github.com/repos/${{ github.repository }}/releases/${{ needs.draft-release.outputs.release-id }}/assets
asset_path: out/make/squirrel.windows/x64/*.exe
asset_name: SKiTCH-Controller-${{ needs.draft-release.outputs.version }}-Setup.exe
asset_content_type: application/octet-stream
- name: Upload all Windows assets
if: matrix.os == 'windows-latest'
run: |
for file in out/make/squirrel.windows/x64/*; do
gh release upload ${{ needs.draft-release.outputs.tag-name }} "$file" --clobber
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload macOS assets
if: matrix.os == 'macos-latest'
run: |
for file in out/make/zip/darwin/**/*.zip; do
gh release upload ${{ needs.draft-release.outputs.tag-name }} "$file" --clobber
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Linux assets
if: matrix.os == 'ubuntu-latest'
run: |
for file in out/make/deb/x64/*.deb out/make/rpm/x64/*.rpm; do
gh release upload ${{ needs.draft-release.outputs.tag-name }} "$file" --clobber
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}