Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

ci(release): refresh the Nix npm hash in the version-bump commit

EtienneLescotc12a6cd7758f
diff --git a/.github/scripts/refresh-nix-npm-hash.sh b/.github/scripts/refresh-nix-npm-hash.sh
new file mode 100755
index 000000000..f9c9c8c48
--- /dev/null
+++ b/.github/scripts/refresh-nix-npm-hash.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+# Rewrites `npmDepsHash` in nix/package.nix for the package-lock.json in the working tree.
+#
+# Called by prerelease.yml and promote.yml right after set-release-version.mjs, in the same
+# commit. The lockfile's root `version` is part of what the hash covers, so every version bump
+# changes it; that commit is `[skip ci]`, and refreshing the hash anywhere later left `nix build`
+# red from the release until a separate bump PR landed. Needs Nix on PATH.
+set -euo pipefail
+
+hash=$(nix run nixpkgs#prefetch-npm-deps -- package-lock.json)
+if [[ -z "$hash" ]]; then
+ echo "::error::prefetch-npm-deps returned an empty hash"
+ exit 1
+fi
+sed -i -E "s|^([[:space:]]*npmDepsHash[[:space:]]*=[[:space:]]*)\"[^\"]*\";|\1\"${hash}\";|" nix/package.nix
+grep -q "npmDepsHash = \"${hash}\";" nix/package.nix || {
+ echo "::error::npmDepsHash line not found in nix/package.nix"
+ exit 1
+}
+echo "npmDepsHash: ${hash}"
diff --git a/.github/workflows/bump-nix-package.yml b/.github/workflows/bump-nix-package.yml
deleted file mode 100644
index 5090b184c..000000000
--- a/.github/workflows/bump-nix-package.yml
+++ /dev/null
@@ -1,123 +0,0 @@
-name: Bump Nix package on release
-
-on:
- release:
- types: [published]
- workflow_dispatch:
- inputs:
- tag:
- description: "Release tag to bump (e.g. v1.5.0)"
- required: true
- type: string
-
-# GITHUB_TOKEN only pushes the branch here — the PR itself is opened with the
-# PAT below, so no `pull-requests: write` is needed (and it never worked).
-permissions:
- contents: write
-
-jobs:
- bump:
- runs-on: ubuntu-latest
- if: github.event_name == 'workflow_dispatch' || !github.event.release.prerelease
- steps:
- - name: Resolve tag and version
- id: meta
- env:
- GH_EVENT_TAG: ${{ github.event.release.tag_name }}
- INPUT_TAG: ${{ inputs.tag }}
- run: |
- set -euo pipefail
- TAG="${GH_EVENT_TAG:-$INPUT_TAG}"
- if [[ -z "$TAG" ]]; then
- echo "::error::No tag resolved from release event or workflow input"
- exit 1
- fi
- VERSION="${TAG#v}"
- BRANCH="chore/bump-nix-${VERSION}"
- echo "tag=$TAG" >> "$GITHUB_OUTPUT"
- echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
-
- - name: Checkout main
- uses: actions/checkout@v7
- with:
- ref: main
- fetch-depth: 0
-
- - name: Install Nix
- uses: cachix/install-nix-action@v27
- with:
- nix_path: nixpkgs=channel:nixos-unstable
- extra_nix_config: |
- experimental-features = nix-command flakes
-
- - name: Compute npmDepsHash
- id: hash
- run: |
- set -euo pipefail
- HASH=$(nix run nixpkgs#prefetch-npm-deps -- package-lock.json)
- if [[ -z "$HASH" ]]; then
- echo "::error::prefetch-npm-deps returned an empty hash"
- exit 1
- fi
- echo "hash=$HASH" >> "$GITHUB_OUTPUT"
- echo "Computed npmDepsHash: $HASH"
-
- - name: Update nix/package.nix
- env:
- VERSION: ${{ steps.meta.outputs.version }}
- HASH: ${{ steps.hash.outputs.hash }}
- run: |
- set -euo pipefail
- # Update version line: ` version = "<anything>";`
- sed -i -E "s|^([[:space:]]*version[[:space:]]*=[[:space:]]*)\"[^\"]*\";|\1\"${VERSION}\";|" nix/package.nix
- # Update npmDepsHash line: ` npmDepsHash = "<anything>";`
- sed -i -E "s|^([[:space:]]*npmDepsHash[[:space:]]*=[[:space:]]*)\"[^\"]*\";|\1\"${HASH}\";|" nix/package.nix
-
- echo "=== diff ==="
- git --no-pager diff nix/package.nix || true
-
- - name: Create PR
- env:
- # NOT GITHUB_TOKEN: the repo has "Allow GitHub Actions to create and
- # approve pull requests" turned off, so `gh pr create` dies with
- # "GitHub Actions is not permitted to create or approve pull requests"
- # — it did exactly that on v1.7.0, after pushing the branch, and #136
- # had to be opened by hand. The PAT every other release workflow
- # already uses has no such restriction, and its PRs trigger CI.
- GH_TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
- VERSION: ${{ steps.meta.outputs.version }}
- HASH: ${{ steps.hash.outputs.hash }}
- BRANCH: ${{ steps.meta.outputs.branch }}
- TAG: ${{ steps.meta.outputs.tag }}
- run: |
- set -euo pipefail
-
- if git diff --quiet -- nix/package.nix; then
- echo "nix/package.nix already at v${VERSION} with this hash — nothing to do."
- exit 0
- fi
-
- git config user.name "github-actions[bot]"
- git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
-
- # Replace any prior bump branch to keep the workflow idempotent.
- git push origin --delete "$BRANCH" 2>/dev/null || true
- git checkout -b "$BRANCH"
- git add nix/package.nix
- git commit -m "chore: bump nix package to v${VERSION}"
- git push -u origin "$BRANCH"
-
- gh pr create \
- --title "chore: bump nix package to v${VERSION}" \
- --base main \
- --head "$BRANCH" \
- --body "$(cat <<EOF
- Automated bump triggered by release \`${TAG}\`.
-
- - \`version\` → \`${VERSION}\`
- - \`npmDepsHash\` → \`${HASH}\` (computed via \`prefetch-npm-deps package-lock.json\`)
-
- Merge this so Nix users (NixOS, Home Manager, \`nix run github:${{ github.repository }}\`) pick up the new release.
- EOF
- )"
diff --git a/.github/workflows/nix-check.yml b/.github/workflows/nix-check.yml
index 49b51cbe3..768644e16 100644
--- a/.github/workflows/nix-check.yml
+++ b/.github/workflows/nix-check.yml
@@ -4,8 +4,8 @@ name: Nix
# package-lock.json resolves to. The two have to agree or `nix build` fails
# outright, and nothing here ever checked that they did.
#
-# The only thing that refreshed the hash was bump-nix-package.yml, which fires
-# on stable releases. `src` is this repo's own tree, not a fetched tarball, so
+# The only thing that refreshed the hash used to be a bump PR opened after each
+# stable release (releases now refresh it in their own version-bump commit). `src` is this repo's own tree, not a fetched tarball, so
# every lockfile change landing between two releases left main's hash pointing
# at dependencies that no longer existed. It last matched on 2026-07-05 (v1.6.0)
# while package-lock.json moved ten more times, so `nix run github:…` was broken
diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml
index 965a6e93e..4cbf8819d 100644
--- a/.github/workflows/prerelease.yml
+++ b/.github/workflows/prerelease.yml
@@ -75,6 +75,13 @@ jobs:
NEXT: ${{ steps.version.outputs.next }}
run: node .github/scripts/release-milestone-migrate.mjs
+ - name: Install Nix
+ uses: cachix/install-nix-action@v27
+ with:
+ nix_path: nixpkgs=channel:nixos-unstable
+ extra_nix_config: |
+ experimental-features = nix-command flakes
+
- name: Create or reuse the release branch and bump package.json
env:
TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
@@ -109,7 +116,9 @@ jobs:
# Writes package-lock.json too. A sed over package.json alone left the
# lockfile behind on every release up to 1.9.0; see the script header.
node .github/scripts/set-release-version.mjs "${PRERELEASE}"
- git add package.json package-lock.json
+ # The lockfile's version is part of Nix's npm hash: refresh it in this same commit.
+ bash .github/scripts/refresh-nix-npm-hash.sh
+ git add package.json package-lock.json nix/package.nix
git commit -m "chore(release): bump to ${PRERELEASE} [skip ci]" || echo "(version already at ${PRERELEASE})"
git push "$REMOTE" "$BRANCH"
diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml
index 7bc090534..e0347be9f 100644
--- a/.github/workflows/promote.yml
+++ b/.github/workflows/promote.yml
@@ -59,6 +59,13 @@ jobs:
STABLE_VERSION: ${{ steps.version.outputs.stable_version }}
run: node .github/scripts/release-milestone-close.mjs
+ - name: Install Nix
+ uses: cachix/install-nix-action@v27
+ with:
+ nix_path: nixpkgs=channel:nixos-unstable
+ extra_nix_config: |
+ experimental-features = nix-command flakes
+
- name: Bump the version to stable on the release branch
env:
TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
@@ -75,9 +82,11 @@ jobs:
# Writes package-lock.json too. A sed over package.json alone left the
# lockfile behind on every release up to 1.9.0; see the script header.
node .github/scripts/set-release-version.mjs "${STABLE_VERSION}"
+ # The lockfile's version is part of Nix's npm hash: refresh it in this same commit.
+ bash .github/scripts/refresh-nix-npm-hash.sh
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- git add package.json package-lock.json
+ git add package.json package-lock.json nix/package.nix
git commit --allow-empty -m "chore(release): bump to ${STABLE_VERSION} [skip ci]" || true
git push "https://x-access-token:${TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "$BRANCH"
diff --git a/nix/package.nix b/nix/package.nix
index f3ae830af..8daaea483 100644
--- a/nix/package.nix
+++ b/nix/package.nix
@@ -27,8 +27,9 @@ buildNpmPackage {
pname = "openscreen";
# Read, not restated. A hand-copied version is one more thing to remember at
# release time and it had already drifted two minors behind the app it names.
- # (`npmDepsHash` below still has to be updated by hand — that is Nix, not a
- # choice — but it fails loudly, where a stale version number never does.)
+ # (`npmDepsHash` below still has to follow the lockfile — that is Nix, not a
+ # choice — but it fails loudly, where a stale version number never does.
+ # nix-check.yml prints it for a lockfile PR; releases refresh it themselves.)
version = (lib.importJSON ../package.json).version;
src =
diff --git a/technical-documentation/engineering/build-and-packaging.md b/technical-documentation/engineering/build-and-packaging.md
index 8305736bc..d7608ff0e 100644
--- a/technical-documentation/engineering/build-and-packaging.md
+++ b/technical-documentation/engineering/build-and-packaging.md
@@ -308,7 +308,7 @@ Electron-builder targets DMG for both `arm64` and `x64`, enables hardened runtim
### Linux and Nix
-Electron-builder produces AppImage, `.deb`, `.pacman`, and `.rpm` targets. Each fpm target carries its own `depends` list, which *replaces* electron-builder's default rather than extending it; all three package formats therefore repeat that default verbatim before adding the Vulkan ICD (`mesa-vulkan-drivers`, `vulkan-swrast` on Arch) the native compositor needs. The RPM list also restores `libsecret`, which electron-builder includes in its `deb` default but omits from its `rpm` one, and which `safeStorage` needs to encrypt LLM credentials. The flake separately supports `x86_64-linux` and `aarch64-linux`, offers NixOS and Home Manager modules, and builds a wrapper around nixpkgs' system Electron. `nix/package.nix` runs Vite directly, installs `dist/`, `dist-electron/`, production npm dependencies, wallpapers, icons, and a desktop entry; it does not invoke electron-builder. The release workflow later opens a PR to update the Nix package version and npm dependency hash after stable releases.
+Electron-builder produces AppImage, `.deb`, `.pacman`, and `.rpm` targets. Each fpm target carries its own `depends` list, which *replaces* electron-builder's default rather than extending it; all three package formats therefore repeat that default verbatim before adding the Vulkan ICD (`mesa-vulkan-drivers`, `vulkan-swrast` on Arch) the native compositor needs. The RPM list also restores `libsecret`, which electron-builder includes in its `deb` default but omits from its `rpm` one, and which `safeStorage` needs to encrypt LLM credentials. The flake separately supports `x86_64-linux` and `aarch64-linux`, offers NixOS and Home Manager modules, and builds a wrapper around nixpkgs' system Electron. `nix/package.nix` runs Vite directly, installs `dist/`, `dist-electron/`, production npm dependencies, wallpapers, icons, and a desktop entry; it does not invoke electron-builder. The version comes from `package.json`; the npm dependency hash is refreshed by the release workflows in the same commit that bumps the version.
## Node and toolchain versions
diff --git a/technical-documentation/engineering/ci-workflows.md b/technical-documentation/engineering/ci-workflows.md
index 95d5082d4..c3016b9bc 100644
--- a/technical-documentation/engineering/ci-workflows.md
+++ b/technical-documentation/engineering/ci-workflows.md
@@ -35,13 +35,11 @@ flowchart TD
subgraph T3["Tier 3 — stable package distribution"]
Homebrew[update-homebrew-cask.yml]
Winget[publish-winget.yml]
- Nix[bump-nix-package.yml]
AUR[aur-publish.yml]
end
Publish -->|stable release published| Homebrew
Publish -->|stable release published| Winget
- Publish -->|stable release published| Nix
Publish -->|stable release published| AUR
subgraph T4["Tier 4 — automation and diagnostics"]
@@ -68,7 +66,6 @@ The STT workflow uploads standalone archives for binary refresh and does not cur
| 2.5 | `promote.yml` | Manual dispatch |
| 3 | `update-homebrew-cask.yml` | Published release; manual dispatch |
| 3 | `publish-winget.yml` | Published release; manual dispatch |
-| 3 | `bump-nix-package.yml` | Published release; manual dispatch |
| 3 | `aur-publish.yml` | Published release; manual dispatch |
| 4 | `discord-pr-notify.yml` | PR target, review, and issue-comment events |
| 4 | `discord-roadmap-sync.yml` | Merged PR to `main`; push to `main` |
@@ -115,7 +112,7 @@ This matrix builds `whisper-stt-server` and its ggml backend sidecars for macOS
## Tier 2.5: release management
-`prerelease.yml` and `promote.yml` orchestrate the frozen release branch, version tags, milestones, build dispatch, and Discord announcements. The full procedure, fallback, branch freeze, and credential requirements live in [release and secrets](release-and-secrets.md).
+`prerelease.yml` and `promote.yml` orchestrate the frozen release branch, version tags, milestones, build dispatch, and Discord announcements. Their version-bump commit also refreshes `npmDepsHash` in `nix/package.nix` (`.github/scripts/refresh-nix-npm-hash.sh`): the lockfile's root version is part of that hash, and the commit is `[skip ci]`, so refreshing it anywhere later left `nix build` red from every release until a separate bump PR landed. The full procedure, fallback, branch freeze, and credential requirements live in [release and secrets](release-and-secrets.md).
At a high level, the RC workflow creates or reuses `release/vX.Y.Z`, tags its tip, and dispatches `build.yml` at that tag. Promotion creates the stable version and tag from the same release branch, syncs it back through a PR, and dispatches the stable build at the tag.
@@ -125,10 +122,9 @@ These workflows run for stable published releases and support manual replay with
- `update-homebrew-cask.yml` waits for both macOS DMGs, hashes them, writes a cask, and pushes to the configured tap. Manual replay refuses any tag that is not a stable `vMAJOR.MINOR.PATCH`, because `workflow_dispatch` takes free text and the `prerelease` filter only covers the `release` event.
- `publish-winget.yml` passes the matching NSIS release asset to `winget-releaser`, after a read-only step checks that the token can create komac's branch in the `winget-pkgs` fork (#757).
-- `bump-nix-package.yml` computes `npmDepsHash`, updates `nix/package.nix`, and opens a PR.
- `aur-publish.yml` hashes the pacman release asset, updates `PKGBUILD` and `.SRCINFO`, and pushes over SSH.
-Each workflow needs variables or credentials, and where it checks for them decides whether a missing one is visible. `update-homebrew-cask.yml` and `publish-winget.yml` check inside a step that emits a warning, so an unconfigured channel says so in the run summary; a job-level `if:` would instead report `skipped`, which reads as green and hid #148 for eight releases and the Homebrew cask for its entire existence (#335). `bump-nix-package.yml` uses the repository `GITHUB_TOKEN`; the others require the external registry credentials described in [release and secrets](release-and-secrets.md).
+Each workflow needs variables or credentials, and where it checks for them decides whether a missing one is visible. `update-homebrew-cask.yml` and `publish-winget.yml` check inside a step that emits a warning, so an unconfigured channel says so in the run summary; a job-level `if:` would instead report `skipped`, which reads as green and hid #148 for eight releases and the Homebrew cask for its entire existence (#335). They require the external registry credentials described in [release and secrets](release-and-secrets.md).
## Tier 4: automation and diagnostics
@@ -140,6 +136,6 @@ Each workflow needs variables or credentials, and where it checks for them decid
## Artifact flow
-Release platform artifacts have 30-day Actions retention. `publish-release` copies the NSIS installer, two architecture-specific DMGs when present, and Linux packages into the GitHub release. It intentionally does not download the independently uploaded Store artifact. A stable published release then fans out to Homebrew, WinGet, Nix, and AUR.
+Release platform artifacts have 30-day Actions retention. `publish-release` copies the NSIS installer, two architecture-specific DMGs when present, and Linux packages into the GitHub release. It intentionally does not download the independently uploaded Store artifact. A stable published release then fans out to Homebrew, WinGet, and AUR.
Diagnostic artifacts remain Actions-only for 14 days. Whisper archives remain Actions-only for 30 days and are used as a binary-refresh output rather than being downloaded by the release workflow. The website build artifact flows only into GitHub Pages deployment.
diff --git a/technical-documentation/engineering/release-and-secrets.md b/technical-documentation/engineering/release-and-secrets.md
index f41637705..8fef17b24 100644
--- a/technical-documentation/engineering/release-and-secrets.md
+++ b/technical-documentation/engineering/release-and-secrets.md
@@ -70,6 +70,7 @@ RC=1.5.0-rc.1 # bump the rc.N for every later candidate
# Cut RC (skips milestone migration and Discord announce)
git checkout -b release/v1.5.0 main # rc.2+: git checkout release/v1.5.0 instead
node .github/scripts/set-release-version.mjs "$RC"
+bash .github/scripts/refresh-nix-npm-hash.sh # needs Nix; the lockfile version is in the hash
git commit -am "chore(release): bump to $RC [skip ci]"
git push origin release/v1.5.0
git tag "v$RC" && git push origin "v$RC"
@@ -77,6 +78,7 @@ git tag "v$RC" && git push origin "v$RC"
# Promote (skips milestone close and Discord announce)
git checkout release/v1.5.0
node .github/scripts/set-release-version.mjs 1.5.0
+bash .github/scripts/refresh-nix-npm-hash.sh
git commit -am "chore(release): bump to 1.5.0 [skip ci]"
git push origin release/v1.5.0
git tag v1.5.0 && git push origin v1.5.0
@@ -219,8 +221,6 @@ The bot token comes from a Discord application authorized with the `bot` scope.
| `AUR_KNOWN_HOSTS` | Variable | Pinned `aur.archlinux.org` host-key lines; required because strict host checking is enabled. | Replace only after independently verifying an AUR host-key change. |
| `AUR_PACKAGE_NAME` | Variable | AUR repository/package name and workflow gate. | Update if the package is renamed. |
-`bump-nix-package.yml` uses the workflow-scoped `GITHUB_TOKEN`; it requires repository contents and pull-request write permissions as declared in the workflow and has no additional long-lived secret.
-
**Homebrew publishing does not complete yet, and now says so.** `update-homebrew-cask.yml` has never published a cask — not once since it was written for the v1.5.0 pipeline. Neither `HOMEBREW_TAP_OWNER` nor `HOMEBREW_TAP_REPO` has ever existed on this repository, both sat in the job-level `if`, and an unconfigured job resolves to `skipped`, which is green: every release run reads as a success. The same failure as WinGet below, found the same way and fixed the same way — the configuration test now lives in a step that names what is missing (#335). Three things are needed, and the third is the one a variable cannot supply: `HOMEBREW_TAP_OWNER` and `HOMEBREW_TAP_REPO`; the `HOMEBREW_TAP_TOKEN` secret with contents write on that repository; and the tap repository itself, which **must** be named `homebrew-<something>` — that prefix is how `brew tap` resolves a repository at all, so `getopenscreen/openscreen-tap` would be checked out and pushed to successfully and still be untappable. With `getopenscreen/homebrew-openscreen`, the install command is `brew install --cask getopenscreen/openscreen/openscreen`.
Note what it would publish before turning it on: the two DMGs attached to the release — signed, notarized and stapled when the Apple credentials above are complete, ad-hoc-signed and un-notarized when they are not. A cask does not change either state, because `brew install --cask` runs the same Gatekeeper path as a manual download: on the ad-hoc artifact users still need to strip the quarantine flag by hand (`xattr -rd com.apple.quarantine`). The README no longer documents that step, because every build since 1.9.0 is notarized and does not need it — so an ad-hoc release would strand users with no written way out. What the tap buys is discovery and `brew upgrade`, not trust.