From 7302f6880e15a64ce533d362ec828c5894023d2a Mon Sep 17 00:00:00 2001 From: Julien Brayere Date: Sat, 14 Nov 2026 22:32:33 +0100 Subject: [PATCH] ci: open a release PR twice a month when the published package changed Adds scripts/release-check.sh and a scheduled release-check workflow that runs release-pr.sh only when shipped files, bundled zstd or package entry points/peer deps changed since the last tag. Renovate now tracks the zstd submodule by release tag (manual review). --- .github/workflows/release-check.yml | 43 +++++++++++++++++++++++++++++ .gitmodules | 2 +- CONTRIBUTING.md | 5 ++++ renovate.json5 | 8 ++++++ scripts/release-check.sh | 25 +++++++++++++++++ 5 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release-check.yml create mode 100755 scripts/release-check.sh diff --git a/.github/workflows/release-check.yml b/.github/workflows/release-check.yml new file mode 100644 index 0000000..91f1016 --- /dev/null +++ b/.github/workflows/release-check.yml @@ -0,0 +1,43 @@ +# Twice a month, opens a patch release PR when the published package changed since the last tag +# (scripts/release-check.sh). Merging that PR publishes via release.yml. +name: Release check + +on: + schedule: + - cron: '0 6 1,15 * *' + workflow_dispatch: + +permissions: + contents: write + pull-requests: write + +concurrency: release-check + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0 + with: + node-version-file: '.nvmrc' + + - name: Next version + id: next + run: echo "version=$(bash scripts/release-check.sh HEAD)" >> "$GITHUB_OUTPUT" + + - name: Open release PR + if: steps.next.outputs.version != '' + env: + GH_TOKEN: ${{ github.token }} + VERSION: ${{ steps.next.outputs.version }} + run: | + open=$(gh pr list --state open --json headRefName -q '.[].headRefName | select(startswith("release/"))') + if [ -n "$open" ]; then echo "release PR already open: $open"; exit 0; fi + git config user.name 'github-actions[bot]' + git config user.email '41898283+github-actions[bot]@users.noreply.github.com' + bash scripts/release-pr.sh "$VERSION" diff --git a/.gitmodules b/.gitmodules index 04cb1d0..291109f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,5 +1,5 @@ [submodule "externals/zstd"] path = externals/zstd url = https://github.com/facebook/zstd.git - tag = v1.5.7 + branch = v1.5.7 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d61446a..77e5ee4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -110,6 +110,11 @@ description (drafted from the commits since the last tag) becomes the release no merging. Merging the PR publishes to npm, tags `v1.5.0` and creates the GitHub release (`.github/workflows/release.yml`). +On the 1st and 15th of each month, `.github/workflows/release-check.yml` opens a patch release PR on its own +when the published package changed since the last tag (`scripts/release-check.sh`: sources, native code, +bundled zstd, entry points, peer deps). Dev-tooling-only changes never trigger one. CI doesn't run on that +PR (it's opened with `GITHUB_TOKEN`). Run the workflow manually to check now. + ### Scripts The `package.json` file contains various scripts for common tasks: diff --git a/renovate.json5 b/renovate.json5 index 0d0d59e..6eadffc 100644 --- a/renovate.json5 +++ b/renovate.json5 @@ -10,6 +10,8 @@ "platformAutomerge": false, "rebaseWhen": "behind-base-branch", "ignoreTests": false, + // zstd release tags, read from `branch` in .gitmodules + "git-submodules": { "enabled": true }, "packageRules": [ { "matchPackageNames": [ @@ -40,6 +42,12 @@ "matchPackageNames": ["expo"], "matchUpdateTypes": ["major"], "prBodyNotes": ["Review the Babel, TypeScript, and ESLint caps in renovate.json5 for this Expo SDK upgrade. Lift them only after Expo Doctor, lint, typecheck, and example builds pass."] + }, + // last so it beats the automerge-all rule: zstd bumps ship to users, review them + { + "matchManagers": ["git-submodules"], + "semanticCommitType": "fix", + "automerge": false } ] } diff --git a/scripts/release-check.sh b/scripts/release-check.sh new file mode 100755 index 0000000..dfab60e --- /dev/null +++ b/scripts/release-check.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# DESCRIPTION: Print the next patch version when the published package changed since the last tag (sources, +# native code, bundled zstd, package.json entry points and peer deps); print nothing otherwise. +# USAGE: scripts/release-check.sh [ref] +# EXAMPLES: +# scripts/release-check.sh # checks origin/main +# scripts/release-check.sh HEAD +set -euo pipefail + +ref=${1:-origin/main} +prev=$(git describe --tags --abbrev=0 --match 'v*' "$ref") +shipped=(src cpp android ios nitrogen nitro.json ':(glob)*.podspec' react-native.config.js externals/zstd) + +manifest() { + git show "$1:package.json" | node -e ' + const p = JSON.parse(require("fs").readFileSync(0, "utf8")); + console.log(JSON.stringify([p.main, p.types, p.exports, p.files, p.peerDependencies]));' +} + +if git diff --quiet "$prev" "$ref" -- "${shipped[@]}" && [[ $(manifest "$prev") == "$(manifest "$ref")" ]]; then + exit 0 +fi + +[[ ${prev#v} =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]] || { echo "last tag is not a plain semver: $prev" >&2; exit 1; } +echo "${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.$((BASH_REMATCH[3] + 1))"