respira/.github/workflows/release.yml
Jan-Henrik Bruhn 3760f05c29 Add web app build and deploy to GitHub Pages root
- Add build-web job that builds the web app
- Publish web app to GitHub Pages root directory
- Keep auto-update files in /update/ subdirectory
- Web app accessible at https://jhbruhn.github.io/respira/
- Auto-update files at /update/win32/x64/ and /update/darwin/arm64/

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-11 13:24:17 +01:00

177 lines
4.6 KiB
YAML

name: Release
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
pull-requests: write
pages: write
id-token: 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 artifacts
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: windows-artifacts
path: out/make/squirrel.windows/x64/*
- name: Upload macOS artifacts
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: macos-artifacts
path: |
out/make/zip/darwin/**/*.zip
out/make/zip/darwin/**/*RELEASES.json
out/make/*.dmg
- name: Upload Linux artifacts
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: linux-artifacts
path: |
out/make/rpm/x64/*.rpm
out/make/deb/x64/*.deb
out/make/AppImage/x64/*.AppImage
upload-to-release:
name: Upload to GitHub Release
needs: [draft-release, build-release]
if: needs.draft-release.outputs.tag-name != ''
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Upload all assets to release
run: |
find artifacts -type f -exec gh release upload ${{ needs.draft-release.outputs.tag-name }} {} --clobber \;
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-web:
name: Build Web App
needs: draft-release
if: needs.draft-release.outputs.tag-name != ''
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 app
run: npm run build
- name: Upload web build artifact
uses: actions/upload-artifact@v4
with:
name: web-build
path: dist/
publish-to-pages:
name: Publish to GitHub Pages
needs: [draft-release, build-release, build-web]
if: needs.draft-release.outputs.tag-name != ''
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Organize files for GitHub Pages
run: |
# Create root directory for web app
mkdir -p pages
# Copy web build to root
cp -r artifacts/web-build/* pages/
# Create update directory structure for auto-update files
mkdir -p pages/update/win32/x64
mkdir -p pages/update/darwin/arm64
# Copy Windows auto-update files
cp artifacts/windows-artifacts/* pages/update/win32/x64/
# Copy macOS auto-update files (only ZIP and RELEASES.json, not DMG)
cp artifacts/macos-artifacts/zip/darwin/arm64/*.zip pages/update/darwin/arm64/
cp artifacts/macos-artifacts/zip/darwin/arm64/RELEASES.json pages/update/darwin/arm64/
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'pages'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4