Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/release-check.yml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -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

5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -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
}
]
}
25 changes: 25 additions & 0 deletions scripts/release-check.sh
Original file line number Diff line number Diff line change
@@ -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))"
Loading