Files
psysonic/.github/workflows/nix-npm-deps-hash-sync.yml
T
cucadmuh bf38288feb ci(release): split channel pipelines and automate version transitions (#345)
* ci(release): split channel pipelines and automate version transitions

Introduce dedicated next/release orchestration workflows backed by a reusable publish pipeline with RC/final package version updates and post-release main dev bump PRs. Add a strict release process SOP with RC freeze, hotfix override, and mandatory backport rules.

* ci(release): gate main-to-next promotion on green CI

Add a dedicated workflow that validates main branch checks/statuses and block the promote-main-to-next flow unless main is green. Update the release SOP to reflect the enforced pre-promotion validation.

* ci(release): fix channel promotion edge cases and policy gaps

Switch channel promotions to reset-based snapshots with force-with-lease pushes, stop auto-merging channel nix-refresh PRs, and guard main dev bump against version downgrades. Add RC changelog fallback, require AUR release updates in SOP, and extend npmDepsHash sync to main/next/release pushes.

* docs(release): clarify backport and nix refresh survivability rules

Require RC fix backports to reach main before the next main-to-next promotion, and document that channel-local nix refresh PRs are advisory unless equivalent changes are merged into main.
2026-04-28 23:20:01 +03:00

71 lines
2.5 KiB
YAML

# Keeps `nix/upstream-sources.json` (`npmDepsHash`) in sync with `package-lock.json`.
# Runs in CI with Nix — contributors do not need Nix locally.
#
# Skips fork PRs (cannot push to the contributor branch); after merge to main,
# next, or release, the push workflow updates the hash on that branch if needed.
name: Sync Nix npmDepsHash
on:
push:
branches: [main, next, release]
paths:
- package-lock.json
- package.json
- nix/upstream-sources.json
pull_request:
paths:
- package-lock.json
- package.json
- nix/upstream-sources.json
workflow_dispatch:
concurrency:
group: nix-npm-hash-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
sync:
runs-on: ubuntu-24.04
permissions:
contents: write
# Fork PRs: token cannot push to the fork — merge to main will run the push workflow instead.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }}
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v15
- name: Recompute npmDepsHash from package-lock.json
run: |
set -euo pipefail
HASH="$(nix run nixpkgs/nixos-unstable#prefetch-npm-deps -- package-lock.json)"
echo "Computed npmDepsHash: $HASH"
TMP="$(mktemp)"
jq --arg h "$HASH" '.npmDepsHash = $h' nix/upstream-sources.json > "$TMP"
mv "$TMP" nix/upstream-sources.json
- name: Commit and push if changed
env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add nix/upstream-sources.json
if git diff --cached --quiet; then
echo "npmDepsHash already matches package-lock.json — nothing to commit."
exit 0
fi
git commit -m "chore(nix): sync npmDepsHash with package-lock.json"
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
git push origin "HEAD:${PR_HEAD_REF}"
else
git push origin "HEAD:${{ github.ref_name }}"
fi