From 78e15432d831ab1692d556647b29894c5ca8ac9d Mon Sep 17 00:00:00 2001 From: Jan-Henrik Bruhn Date: Mon, 15 Dec 2025 13:50:41 +0100 Subject: [PATCH 1/3] fix: Build web app with version in release workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moves web app build from publish-pages workflow to release workflow to ensure version consistency and better artifact management. Changes: - Added build-web job to release.yml that: - Updates package.json with the release version - Builds the web app with proper base path - Creates a versioned zip artifact (respira-web-{version}.zip) - Uploads as a release asset alongside desktop builds - Updated publish-pages.yml to: - Remove the build-web job (no longer needed) - Download the pre-built web artifact from the release - Extract and deploy the versioned build Benefits: - All artifacts (desktop + web) built together with same version - Web app now includes correct version number in package.json - Simpler and faster publish-pages workflow (no rebuild needed) - Better caching and consistency across deployments 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/publish-pages.yml | 38 +++------------------------- .github/workflows/release.yml | 39 ++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/.github/workflows/publish-pages.yml b/.github/workflows/publish-pages.yml index 7506427..9d735c1 100644 --- a/.github/workflows/publish-pages.yml +++ b/.github/workflows/publish-pages.yml @@ -10,35 +10,8 @@ permissions: id-token: write jobs: - build-web: - name: Build Web App - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v6 - with: - node-version-file: ".node-version" - cache: "npm" - - - name: Install dependencies - run: npm ci - - - name: Build web app - run: npm run build -- --base=/respira/ - - - 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: build-web runs-on: ubuntu-latest environment: name: github-pages @@ -48,20 +21,15 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Download web build artifact - uses: actions/download-artifact@v4 - with: - name: web-build - path: web-build - - name: Download release assets run: | # Create directory structure mkdir -p pages/update/win32/x64 mkdir -p pages/update/darwin/arm64 - # Copy web build to root - cp -r web-build/* pages/ + # Download and extract web build from the release + gh release download ${{ github.event.release.tag_name }} --pattern "respira-web-*.zip" + unzip -q respira-web-*.zip -d pages/ # Download Windows auto-update files from the release gh release download ${{ github.event.release.tag_name }} --pattern "*.exe" --dir pages/update/win32/x64 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8da4f11..e02de27 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,43 @@ jobs: env: GITHUB_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@v6 + with: + node-version-file: ".node-version" + 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: Build web app + run: npm run build -- --base=/respira/ + + - name: Create web artifact zip + run: | + cd dist + zip -r ../respira-web-${{ needs.draft-release.outputs.version }}.zip . + + - name: Upload web artifact + uses: actions/upload-artifact@v4 + with: + name: web-artifacts + path: respira-web-${{ needs.draft-release.outputs.version }}.zip + build-release: name: Build Release - ${{ matrix.os }} needs: draft-release @@ -86,7 +123,7 @@ jobs: upload-to-release: name: Upload to GitHub Release - needs: [draft-release, build-release] + needs: [draft-release, build-web, build-release] if: needs.draft-release.outputs.tag-name != '' runs-on: ubuntu-latest From 2891eea03bf05d2f8e0a0ea665e6f1dca82c4a02 Mon Sep 17 00:00:00 2001 From: Jan-Henrik Bruhn Date: Mon, 15 Dec 2025 13:51:37 +0100 Subject: [PATCH 2/3] fix: Rename release.yml to draft-release.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Renames the workflow file to better reflect its purpose of creating and maintaining draft releases. Changes: - Renamed .github/workflows/release.yml to .github/workflows/draft-release.yml - Updated workflow name from "Release" to "Draft Release" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/{release.yml => draft-release.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{release.yml => draft-release.yml} (99%) diff --git a/.github/workflows/release.yml b/.github/workflows/draft-release.yml similarity index 99% rename from .github/workflows/release.yml rename to .github/workflows/draft-release.yml index e02de27..cbfc88a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/draft-release.yml @@ -1,4 +1,4 @@ -name: Release +name: Draft Release on: push: From f2c5716ad83ba0d7b2d70e651ef7d3aead9c3cbd Mon Sep 17 00:00:00 2001 From: Jan-Henrik Bruhn Date: Mon, 15 Dec 2025 13:53:01 +0100 Subject: [PATCH 3/3] fix: Only build and upload artifacts on main branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds conditions to build and upload jobs to only run when triggered by pushes to the main branch, preventing unnecessary builds on pull requests. Changes: - Updated build-web job condition to include `github.ref == 'refs/heads/main'` - Updated build-release job condition to include `github.ref == 'refs/heads/main'` - Updated upload-to-release job condition to include `github.ref == 'refs/heads/main'` This ensures: - Pull requests only update the draft release notes (via release-drafter) - Actual builds and artifact uploads only happen on main branch pushes - More efficient CI/CD pipeline with reduced unnecessary builds 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .github/workflows/draft-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index cbfc88a..9600274 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -30,7 +30,7 @@ jobs: build-web: name: Build Web App needs: draft-release - if: needs.draft-release.outputs.tag-name != '' + if: needs.draft-release.outputs.tag-name != '' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: @@ -67,7 +67,7 @@ jobs: build-release: name: Build Release - ${{ matrix.os }} needs: draft-release - if: needs.draft-release.outputs.tag-name != '' + if: needs.draft-release.outputs.tag-name != '' && github.ref == 'refs/heads/main' runs-on: ${{ matrix.os }} strategy: @@ -124,7 +124,7 @@ jobs: upload-to-release: name: Upload to GitHub Release needs: [draft-release, build-web, build-release] - if: needs.draft-release.outputs.tag-name != '' + if: needs.draft-release.outputs.tag-name != '' && github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: