From 6cea0f91de5c8ab1d97dd6b226132f4f5724f90a Mon Sep 17 00:00:00 2001 From: Angel Davila Date: Mon, 23 Nov 2026 20:31:47 -0600 Subject: [PATCH 1/2] Run release builds in bash and build installers on Release PRs. - Windows steps ran in PowerShell, where "$SCRIPT" is empty: `pnpm run ""` built nothing, so v0.2.0 and v0.3.0 never published. Every release step now runs in bash. - release.yml builds all three installers (no publish) on PRs that touch packaging, including every Release PR, so a broken build fails before its tag exists. - A manual run given a tag builds that tag's source and publishes its missing release, marked latest only if it is the newest version. - Platforms no longer cancel each other on failure. --- .changeset/release-windows-build.md | 5 ++ .github/workflows/ci.yml | 5 +- .github/workflows/release.yml | 119 +++++++++++++++++++++++----- docs/RELEASING.md | 24 +++++- 4 files changed, 128 insertions(+), 25 deletions(-) create mode 100644 .changeset/release-windows-build.md diff --git a/.changeset/release-windows-build.md b/.changeset/release-windows-build.md new file mode 100644 index 0000000..483bad9 --- /dev/null +++ b/.changeset/release-windows-build.md @@ -0,0 +1,5 @@ +--- +"lyra": patch +--- + +Updates reach you again. The 0.2.0 and 0.3.0 releases never published their installers, so Check for updates kept offering 0.1.2; 0.3.1 has everything from both. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 431a4c2..75ecbf8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,7 @@ # CI: typecheck, lint and bundle the app, check and build the website, and refuse a PR without a -# changeset (.changeset/README.md). Runs on PRs only. Installers are packaged only by release.yml, -# from a version tag; a manual run of release.yml builds them without publishing. +# changeset (.changeset/README.md). Runs on PRs only. Installers are packaged only by release.yml: +# it publishes them from a version tag, and builds them without publishing on a PR that touches +# packaging (every Release PR does) or on a manual run. name: ci on: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cd69b18..7ff681c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,43 +1,119 @@ -# Release: on a version tag (v1.2.3), build the installers on macOS, Windows and Linux, attest -# them, and publish the GitHub release. The body is this version's CHANGELOG.md section. The +# Release: build the installers on macOS, Windows and Linux. On a version tag (v1.2.3), also attest +# them and publish the GitHub release. The body is this version's CHANGELOG.md section. The # latest*.yml files and blockmaps are what electron-updater reads from releases/latest. +# +# A pull request that touches packaging or the version builds every installer without publishing. +# Every Release PR bumps apps/lyra/package.json, so a release that can't build fails there, before +# its tag exists. A manual run builds the chosen branch, or, given a tag whose release failed, +# builds that tag's source with this workflow and publishes it (docs/RELEASING.md). name: release on: push: tags: ["v*"] + pull_request: + paths: + - .github/workflows/release.yml + - package.json + - pnpm-lock.yaml + - pnpm-workspace.yaml + - apps/lyra/package.json + - apps/lyra/electron-builder.yml + - apps/lyra/build/** + - apps/lyra/native/** + - apps/lyra/scripts/build-mac-helpers.cjs + - apps/lyra/scripts/fix-whisper-rpath.cjs + - apps/lyra/scripts/prepare-llama.cjs workflow_dispatch: + inputs: + tag: + description: "An existing version tag (vX.Y.Z) with no release: build it and publish it. Empty: build this branch only." + type: string + default: "" + +# a PR's newer push cancels its older build; runs for a tag never cancel each other +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || (inputs.tag && format('refs/tags/{0}', inputs.tag)) || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} # read-only by default; the publish job takes exactly the write scopes it needs permissions: contents: read +# Windows runners default to PowerShell, where "$SCRIPT" is an empty PowerShell variable rather than +# the env var. `pnpm run ""` only lists the scripts and exits 0, which is how v0.2.0 and v0.3.0 +# built nothing and never published. Every step runs in bash, on every OS. +defaults: + run: + shell: bash + jobs: version: runs-on: ubuntu-latest outputs: version: ${{ steps.v.outputs.version }} + tag: ${{ steps.v.outputs.tag }} + ref: ${{ steps.v.outputs.ref }} + app: ${{ steps.v.outputs.app }} + latest: ${{ steps.v.outputs.latest }} steps: + # a manual run given a tag reads that tag's source; anything else, the commit that triggered it - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + ref: ${{ inputs.tag && format('refs/tags/{0}', inputs.tag) || '' }} persist-credentials: false - name: Version id: v + env: + INPUT_TAG: ${{ inputs.tag }} + GH_TOKEN: ${{ github.token }} run: | + case "$GITHUB_EVENT_NAME" in + push) tag=$GITHUB_REF_NAME ;; + workflow_dispatch) tag=$INPUT_TAG ;; + *) tag= ;; + esac # tag names may only be versions: nothing else ever reaches a shell - case "$GITHUB_REF_NAME" in v[0-9]*.[0-9]*.[0-9]*) ;; *) [ "$GITHUB_EVENT_NAME" = workflow_dispatch ] || { echo "not a version tag: $GITHUB_REF_NAME"; exit 1; } ;; esac - pkg=$(node -p "require('./apps/lyra/package.json').version") - if [ "$GITHUB_EVENT_NAME" != workflow_dispatch ] && [ "v$pkg" != "$GITHUB_REF_NAME" ]; then - echo "tag $GITHUB_REF_NAME does not match apps/lyra/package.json $pkg"; exit 1 + if [ -n "$tag" ]; then + case "$tag" in *[!A-Za-z0-9.+-]*) echo "not a version tag: $tag"; exit 1 ;; esac + case "$tag" in v[0-9]*.[0-9]*.[0-9]*) ;; *) echo "not a version tag: $tag"; exit 1 ;; esac + if gh release view "$tag" --repo "$GITHUB_REPOSITORY" > /dev/null 2>&1; then + echo "$tag already has a release"; exit 1 + fi + fi + + # tags from before the Turborepo move (v0.2.0 and older) keep the app at the root + if [ -f apps/lyra/package.json ]; then app=apps/lyra; else app=.; fi + pkg=$(node -p "require('./$app/package.json').version" | tr -cd 'A-Za-z0-9.+-') + if [ -n "$tag" ] && [ "v$pkg" != "$tag" ]; then + echo "tag $tag does not match $app/package.json $pkg"; exit 1 + fi + # the release body; checked on every run so a missing CHANGELOG section fails before the builds + node scripts/release-notes.mjs "$pkg" > /dev/null + + latest=false + if [ -n "$tag" ]; then + # releases/latest is what every install updates to: only the newest stable version + # takes it, so an older tag published late never replaces a newer release there + newest=$(gh api --paginate "repos/$GITHUB_REPOSITORY/tags" --jq '.[].name' | { grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' || true; } | sort -V | tail -n 1) + if [ "$tag" = "$newest" ]; then latest=true; fi fi - echo "version=$(printf %s "$pkg" | tr -cd 'A-Za-z0-9.+-')" >> "$GITHUB_OUTPUT" + + { + echo "version=$pkg" + echo "tag=$tag" + echo "ref=${tag:+refs/tags/$tag}" + echo "app=$app" + echo "latest=$latest" + } >> "$GITHUB_OUTPUT" build: name: ${{ matrix.name }} needs: version runs-on: ${{ matrix.os }} strategy: - fail-fast: true + # one platform failing leaves the others running, so a broken build shows every failure at once + fail-fast: false matrix: include: - name: macOS @@ -52,6 +128,7 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + ref: ${{ needs.version.outputs.ref }} persist-credentials: false - uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0 - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 @@ -64,23 +141,26 @@ jobs: - name: Install dependencies run: pnpm install --frozen-lockfile - name: Typecheck and package + working-directory: ${{ needs.version.outputs.app }} env: SCRIPT: ${{ matrix.script }} - run: pnpm --filter lyra run "$SCRIPT" + run: pnpm run "$SCRIPT" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: ${{ matrix.name }}-dist if-no-files-found: error path: | - apps/lyra/dist/*.dmg - apps/lyra/dist/*.zip - apps/lyra/dist/*-setup.exe - apps/lyra/dist/*.AppImage - apps/lyra/dist/*.deb - apps/lyra/dist/latest*.yml - apps/lyra/dist/*.blockmap + ${{ needs.version.outputs.app }}/dist/*.dmg + ${{ needs.version.outputs.app }}/dist/*.zip + ${{ needs.version.outputs.app }}/dist/*-setup.exe + ${{ needs.version.outputs.app }}/dist/*.AppImage + ${{ needs.version.outputs.app }}/dist/*.deb + ${{ needs.version.outputs.app }}/dist/latest*.yml + ${{ needs.version.outputs.app }}/dist/*.blockmap + # only version tags publish: a tag push, or a manual run given a tag publish: + if: needs.version.outputs.tag != '' needs: [version, build] runs-on: ubuntu-latest permissions: @@ -90,6 +170,7 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + ref: ${{ needs.version.outputs.ref }} persist-credentials: false - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: @@ -114,11 +195,11 @@ jobs: VERSION: ${{ needs.version.outputs.version }} run: node scripts/release-notes.mjs "$VERSION" > release-notes.md && cat release-notes.md - # only version tags publish; a manual run stops after building and attesting - uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3 - if: startsWith(github.ref, 'refs/tags/v') with: + tag_name: ${{ needs.version.outputs.tag }} body_path: release-notes.md files: out/* fail_on_unmatched_files: true - prerelease: ${{ contains(github.ref_name, '-') }} + prerelease: ${{ contains(needs.version.outputs.tag, '-') }} + make_latest: ${{ needs.version.outputs.latest }} diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 1cab560..95df2d5 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -15,7 +15,9 @@ Lyra is one desktop app shipped as installers for macOS, Windows and Linux, vers that changed meaning, a model to re-download, a behaviour that changed), add an `**Upgrade:**` line to the changeset. It ends up in the changelog and the GitHub release. 4. CI (`ci.yml`) typechecks, lints and bundles the app, and refuses a PR without a changeset. It - doesn't package installers; only `release.yml` does. + doesn't package installers; only `release.yml` does. `release.yml` also runs on a PR that + touches packaging (`electron-builder.yml`, `apps/lyra/package.json`, the lockfile, the + workflow itself) and builds every installer there without publishing. ## Versions (before 1.0) @@ -33,9 +35,9 @@ in a way older versions cannot read says so in its `**Upgrade:**` line. 1. Merging to `main` runs `version.yml`, which keeps a **"Release vX.Y.Z"** pull request open. It bumps the version, writes `CHANGELOG.md` from the pending changesets and deletes them. Review it like any PR: is the changelog readable, are upgrade notes present. -2. Before merging the release PR, build the release candidate: run `release.yml` by hand on the - release PR's branch (`gh workflow run release --ref changeset-release/main`). A manual run - builds and attests the installers but doesn't publish. Download them from that run (the +2. The release PR bumps `apps/lyra/package.json`, so `release.yml` builds the release candidate + on it: the `macOS`, `Windows` and `Linux` checks. Don't merge until all three pass; a release + that can't build fails here, before its tag exists. Download the installers from that run (the `*-dist` artifacts), install at least one over the current release, and check that pages open, dictation records and transcribes, and Settings shows the new version. 3. Merge. `version.yml` runs `pnpm release:tag`, which pushes `vX.Y.Z`. `release.yml` builds the @@ -54,6 +56,20 @@ offered to users can stay a GitHub pre-release. By hand, without the workflow: `pnpm release:version` on `main`, commit, `pnpm release:tag`. +## A release that failed + +If `release.yml` fails on a tag, the tag exists but has no GitHub release, and `releases/latest` +keeps offering the previous version. Re-running that run doesn't help: it uses the workflow as it +was at the tag. Fix the cause on `main`, then publish the tag from there: + +```bash +gh workflow run release --ref main -f tag=vX.Y.Z +``` + +That run builds the tag's own source with `main`'s workflow, attests it and publishes the release. +It is marked latest only if no newer version tag exists, and a tag that already has a release is +refused. + ## Pre-releases `pnpm changeset pre enter beta` on `main` (or a release branch); every release is then From 2ff0958a69f56362fe899bd99d4e1f3ded8cc2e4 Mon Sep 17 00:00:00 2001 From: Angel Davila Date: Mon, 23 Nov 2026 20:35:36 -0600 Subject: [PATCH 2/2] Build installers only from a tag or a manual run, not on pull requests. - The Release PR is updated on every merge to main, so building it would package all three installers on nearly every merge. Releases stay the only automatic build. - A manual run without a tag attests again, as before. --- .github/workflows/ci.yml | 5 ++--- .github/workflows/release.yml | 40 ++++++++++------------------------- docs/RELEASING.md | 12 +++++------ 3 files changed, 19 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75ecbf8..431a4c2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,6 @@ # CI: typecheck, lint and bundle the app, check and build the website, and refuse a PR without a -# changeset (.changeset/README.md). Runs on PRs only. Installers are packaged only by release.yml: -# it publishes them from a version tag, and builds them without publishing on a PR that touches -# packaging (every Release PR does) or on a manual run. +# changeset (.changeset/README.md). Runs on PRs only. Installers are packaged only by release.yml, +# from a version tag; a manual run of release.yml builds them without publishing. name: ci on: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7ff681c..3877876 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,29 +1,14 @@ -# Release: build the installers on macOS, Windows and Linux. On a version tag (v1.2.3), also attest -# them and publish the GitHub release. The body is this version's CHANGELOG.md section. The +# Release: on a version tag (v1.2.3), build the installers on macOS, Windows and Linux, attest +# them, and publish the GitHub release. The body is this version's CHANGELOG.md section. The # latest*.yml files and blockmaps are what electron-updater reads from releases/latest. # -# A pull request that touches packaging or the version builds every installer without publishing. -# Every Release PR bumps apps/lyra/package.json, so a release that can't build fails there, before -# its tag exists. A manual run builds the chosen branch, or, given a tag whose release failed, -# builds that tag's source with this workflow and publishes it (docs/RELEASING.md). +# A manual run builds and attests the chosen branch without publishing, or, given a tag whose +# release failed, builds that tag's source with this workflow and publishes it (docs/RELEASING.md). name: release on: push: tags: ["v*"] - pull_request: - paths: - - .github/workflows/release.yml - - package.json - - pnpm-lock.yaml - - pnpm-workspace.yaml - - apps/lyra/package.json - - apps/lyra/electron-builder.yml - - apps/lyra/build/** - - apps/lyra/native/** - - apps/lyra/scripts/build-mac-helpers.cjs - - apps/lyra/scripts/fix-whisper-rpath.cjs - - apps/lyra/scripts/prepare-llama.cjs workflow_dispatch: inputs: tag: @@ -31,10 +16,9 @@ on: type: string default: "" -# a PR's newer push cancels its older build; runs for a tag never cancel each other +# a tag push and a manual run for the same tag never publish at once concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || (inputs.tag && format('refs/tags/{0}', inputs.tag)) || github.ref }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} + group: ${{ github.workflow }}-${{ (inputs.tag && format('refs/tags/{0}', inputs.tag)) || github.ref }} # read-only by default; the publish job takes exactly the write scopes it needs permissions: @@ -68,11 +52,8 @@ jobs: INPUT_TAG: ${{ inputs.tag }} GH_TOKEN: ${{ github.token }} run: | - case "$GITHUB_EVENT_NAME" in - push) tag=$GITHUB_REF_NAME ;; - workflow_dispatch) tag=$INPUT_TAG ;; - *) tag= ;; - esac + # a manual run without a tag only builds + if [ "$GITHUB_EVENT_NAME" = push ]; then tag=$GITHUB_REF_NAME; else tag=$INPUT_TAG; fi # tag names may only be versions: nothing else ever reaches a shell if [ -n "$tag" ]; then case "$tag" in *[!A-Za-z0-9.+-]*) echo "not a version tag: $tag"; exit 1 ;; esac @@ -158,9 +139,7 @@ jobs: ${{ needs.version.outputs.app }}/dist/latest*.yml ${{ needs.version.outputs.app }}/dist/*.blockmap - # only version tags publish: a tag push, or a manual run given a tag publish: - if: needs.version.outputs.tag != '' needs: [version, build] runs-on: ubuntu-latest permissions: @@ -195,7 +174,10 @@ jobs: VERSION: ${{ needs.version.outputs.version }} run: node scripts/release-notes.mjs "$VERSION" > release-notes.md && cat release-notes.md + # only version tags publish (a tag push, or a manual run given a tag); a manual run without + # one stops after building and attesting - uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3 + if: needs.version.outputs.tag != '' with: tag_name: ${{ needs.version.outputs.tag }} body_path: release-notes.md diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 95df2d5..ea0251f 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -15,9 +15,7 @@ Lyra is one desktop app shipped as installers for macOS, Windows and Linux, vers that changed meaning, a model to re-download, a behaviour that changed), add an `**Upgrade:**` line to the changeset. It ends up in the changelog and the GitHub release. 4. CI (`ci.yml`) typechecks, lints and bundles the app, and refuses a PR without a changeset. It - doesn't package installers; only `release.yml` does. `release.yml` also runs on a PR that - touches packaging (`electron-builder.yml`, `apps/lyra/package.json`, the lockfile, the - workflow itself) and builds every installer there without publishing. + doesn't package installers; only `release.yml` does. ## Versions (before 1.0) @@ -35,9 +33,11 @@ in a way older versions cannot read says so in its `**Upgrade:**` line. 1. Merging to `main` runs `version.yml`, which keeps a **"Release vX.Y.Z"** pull request open. It bumps the version, writes `CHANGELOG.md` from the pending changesets and deletes them. Review it like any PR: is the changelog readable, are upgrade notes present. -2. The release PR bumps `apps/lyra/package.json`, so `release.yml` builds the release candidate - on it: the `macOS`, `Windows` and `Linux` checks. Don't merge until all three pass; a release - that can't build fails here, before its tag exists. Download the installers from that run (the +2. Before merging the release PR, build the release candidate: run `release.yml` by hand on the + release PR's branch (`gh workflow run release --ref changeset-release/main`). A manual run + builds and attests the installers but doesn't publish. Don't skip it: it is the only build + before the tag, and a release that fails on its tag never reaches users (see "A release that + failed"). Download the installers from that run (the `*-dist` artifacts), install at least one over the current release, and check that pages open, dictation records and transcribes, and Settings shows the new version. 3. Merge. `version.yml` runs `pnpm release:tag`, which pushes `vX.Y.Z`. `release.yml` builds the