Skip to content

chore: make v2.22.4 release runner observable and idempotent #118

chore: make v2.22.4 release runner observable and idempotent

chore: make v2.22.4 release runner observable and idempotent #118

Workflow file for this run

name: Publish Package to npmjs
on:
push:
branches:
- automation/release-v2.22.4
paths:
- .github/workflows/publish.yml
pull_request:
branches:
- master
permissions:
id-token: write
contents: write
concurrency:
group: release-v2.22.4
cancel-in-progress: false
jobs:
build:
if: github.event_name == 'push' || github.head_ref == 'automation/release-v2.22.4'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
with:
ref: ef375f3a20b26634f45447e4d71ecb73efa00bb6
fetch-depth: 0
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- name: Prepare publish version
env:
PUBLISH_VERSION: v2.22.4
run: bun scripts/prepublish.ts
- name: Verify package version
run: |
ACTUAL_VERSION="$(node -p "require('./package.json').version")"
echo "expected 2.22.4, package.json has ${ACTUAL_VERSION}"
test "${ACTUAL_VERSION}" = "2.22.4"
- name: Build package
run: bun run build
- name: Set up Node.js 18 for runtime verification
uses: actions/setup-node@v6
with:
node-version: '18.17.0'
- name: Verify built CLI with Node.js 18
run: |
node --version
node lib/bin.js -v
node lib/bin-cresc.js -v
node -e "const m = require('./lib/exports.js'); if (!m) process.exit(1)"
node -e "const d = require('./lib/diff.js'); if (!d.diffCommands) process.exit(1)"
- name: Set up Node.js for npm publishing
uses: actions/setup-node@v6
with:
node-version: '24.x'
registry-url: 'https://registry.npmjs.org'
- name: Verify publishable package contents
run: npm pack --dry-run --ignore-scripts
- name: Check whether npm version already exists
id: npm-version
shell: bash
run: |
if npm view react-native-update-cli@2.22.4 version >/dev/null 2>&1; then
echo "exists=true" >> "$GITHUB_OUTPUT"
echo "react-native-update-cli@2.22.4 already exists; npm publish will be skipped"
else
echo "exists=false" >> "$GITHUB_OUTPUT"
fi
- name: Publish to npm
if: steps.npm-version.outputs.exists != 'true'
shell: bash
run: |
if npm publish --ignore-scripts --provenance --access public; then
exit 0
fi
if npm view react-native-update-cli@2.22.4 version >/dev/null 2>&1; then
echo "2.22.4 became available concurrently; treating publish as successful"
exit 0
fi
exit 1
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
if gh release view v2.22.4 --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo "GitHub release v2.22.4 already exists"
exit 0
fi
if gh release create v2.22.4 \
--repo "$GITHUB_REPOSITORY" \
--target ef375f3a20b26634f45447e4d71ecb73efa00bb6 \
--title "v2.22.4" \
--notes "Fix Hermes base equivalence verification for UIntSwitchImm jump-table offsets. Tighten StringSwitchImm/UIntSwitchImm normalization so semantic operands remain checked, with regression coverage for IDs, labels, ranges, and malformed switch shapes."; then
exit 0
fi
gh release view v2.22.4 --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1