Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d23d93d
Ensure the new major is higher than the previous one
j-piasecki Jan 29, 2026
40e7fcc
Try to infer the prerelease version from branch if not provided
j-piasecki Jan 29, 2026
d36322e
Move arg parsing to a helper
j-piasecki Jan 29, 2026
e630c88
Split detecting next latest and verifying it
j-piasecki Jan 29, 2026
e85adbb
Move parseArguments to a separate file
j-piasecki Jan 29, 2026
c1366d0
Move version resolution to version-utils
j-piasecki Jan 29, 2026
6d07c72
Move getVersion to separate file
j-piasecki Jan 29, 2026
3e3f2b0
Add release scripts tests
j-piasecki Jan 29, 2026
dd8a13f
Allow explicitly setting version for stable release
j-piasecki Jan 29, 2026
1c6ec40
Update action
j-piasecki Jan 29, 2026
305627c
Update workflow
j-piasecki Jan 29, 2026
64869c4
Allow on fork
j-piasecki Jan 29, 2026
58f091a
Use `format()`
j-piasecki Jan 29, 2026
6d1b0a3
Don't commit to main
j-piasecki Jan 29, 2026
49d4c82
Run version checks sooner
j-piasecki Jan 29, 2026
d093c91
Always explicitly set npm tag
j-piasecki Jan 29, 2026
8bbbb25
Validate non-latest versions
j-piasecki Jan 29, 2026
06d9bc1
Redisable on forks
j-piasecki Jan 29, 2026
1399227
Add tests
j-piasecki Jan 29, 2026
8c67891
Update wildcards
j-piasecki Jan 29, 2026
1da92a5
Address simple remarks
j-piasecki Jan 29, 2026
f3ad677
Fix test action
j-piasecki Jan 29, 2026
bf5a4a6
Merge branch 'main' into update-release-flow
j-piasecki Feb 3, 2026
5305079
Run all jest tests on ci
j-piasecki Feb 3, 2026
32e4fdc
Always run the second test set
j-piasecki Feb 3, 2026
1f8b2e6
Rename
j-piasecki Feb 3, 2026
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
90 changes: 55 additions & 35 deletions .github/actions/publish-npm-package/action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: publish-npm-package
description: Build and publish react-native-gesture-handler package to npm
inputs:
is-commitly:
description: Whether the release should be marked as nightly.
default: "true"
release-type:
description: Release type to be published (stable, commitly, beta, rc).
default: "commitly"
version:
description: Specific version to publish (usually inferred from x.y-stable branch name).
default: ""
dry-run:
description: Whether to perform a dry run of the publish.
default: "true"
Expand All @@ -28,10 +31,49 @@ runs:
id: set-package-version
shell: bash
run: |
VERSION=$(node ./scripts/release/set-package-version.js ${{ inputs.is-commitly == 'true' && '--commitly' || '' }})
VERSION=$(node ./scripts/release/set-package-version.js ${{ inputs.release-type == 'commitly' && '--commitly' || '' }} ${{ inputs.release-type == 'beta' && '--beta' || '' }} ${{ inputs.release-type == 'rc' && '--rc' || '' }} ${{ inputs.version != '' && format('--version ''{0}''', inputs.version) || '' }})
echo "Updated package version to $VERSION"
Comment thread
j-piasecki marked this conversation as resolved.
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Figure out the correct npm tag
id: figure-out-npm-tag
shell: bash
run: |
if [ "${{ inputs.release-type == 'commitly' }}" = "true" ]; then
TAG_ARGUMENT="--tag nightly"
else
if [ "${{ inputs.release-type == 'beta' || inputs.release-type == 'rc' }}" = "true" ]; then
TAG_ARGUMENT="--tag next"
else
if [ $(node ./scripts/release/should-be-latest.js ${{ steps.set-package-version.outputs.version }}) = "true" ]; then
TAG_ARGUMENT="--tag latest"
else
TAG_ARGUMENT="--tag legacy"
fi
fi
fi

echo "Determined tag argument: $TAG_ARGUMENT"
echo "tag-argument=$TAG_ARGUMENT" >> $GITHUB_OUTPUT

- name: Validate latest version
if: steps.figure-out-npm-tag.outputs.tag-argument == '--tag latest'
shell: bash
run: |
node ./scripts/release/validate-latest-version.js ${{ steps.set-package-version.outputs.version }}

- name: Validate non-latest version
if: steps.figure-out-npm-tag.outputs.tag-argument != '--tag latest'
shell: bash
run: |
node ./scripts/release/validate-non-latest-version.js ${{ steps.set-package-version.outputs.version }}

- name: Print outputs
shell: bash
run: |
echo "Version to be published: ${{ steps.set-package-version.outputs.version }}"
echo "NPM tag argument: ${{ steps.figure-out-npm-tag.outputs.tag-argument }}"

# Ensure npm 11.5.1 or later is installed for OIDC
- name: Update npm
shell: bash
Expand Down Expand Up @@ -63,51 +105,29 @@ runs:
name: ${{ env.PACKAGE_NAME }}
path: './packages/react-native-gesture-handler/${{ env.PACKAGE_NAME }}'

- name: Figure out the correct npm tag
id: figure-out-npm-tag
shell: bash
run: |
if [ "${{ inputs.is-commitly }}" = "true" ]; then
TAG_ARGUMENT="--tag nightly"
else
if [ $(node ./scripts/release/should-be-latest.js ${{ steps.set-package-version.outputs.version }}) = "true" ]; then
TAG_ARGUMENT="--tag latest"
else
TAG_ARGUMENT=""
fi
fi

echo "Determined tag argument: $TAG_ARGUMENT"
echo "tag-argument=$TAG_ARGUMENT" >> $GITHUB_OUTPUT

- name: Print outputs
shell: bash
run: |
echo "Version to be published: ${{ steps.set-package-version.outputs.version }}"
echo "NPM tag argument: ${{ steps.figure-out-npm-tag.outputs.tag-argument }}"

- name: Publish npm package
shell: bash
if: inputs.dry-run == 'false'
working-directory: packages/react-native-gesture-handler
run: |
npm publish $PACKAGE_NAME --provenance ${{ steps.figure-out-npm-tag.outputs.tag-argument }}
npm publish $PACKAGE_NAME --provenance ${{ steps.figure-out-npm-tag.outputs.tag-argument }} ${{ inputs.dry-run == 'true' && '--dry-run' || '' }}

- name: Don't publish if dry-run is true
- name: Delete legacy tag
Comment thread
j-piasecki marked this conversation as resolved.
if: inputs.dry-run == 'false' && steps.figure-out-npm-tag.outputs.tag-argument == '--tag legacy'
shell: bash
if: inputs.dry-run == 'true'
run: |
echo "At this point, the following command would have been run: npm publish $PACKAGE_NAME --provenance ${{ steps.figure-out-npm-tag.outputs.tag-argument }}"
npm dist-tag rm react-native-gesture-handler legacy || echo "No legacy tag to remove"

- name: Configure git
if: inputs.is-commitly == 'false'
if: inputs.release-type == 'stable'
id: configure-git
shell: bash
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
echo "branch-name=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT

- name: Create release commit
if: inputs.is-commitly == 'false'
if: inputs.release-type == 'stable' && steps.configure-git.outputs.branch-name != 'main'
shell: bash
run: |
git add packages/react-native-gesture-handler/package.json
Expand All @@ -121,7 +141,7 @@ runs:
fi

- name: Create release tag
if: inputs.is-commitly == 'false'
if: inputs.release-type == 'stable'
shell: bash
run: |
git tag -a "v${{ steps.set-package-version.outputs.version }}" -m "Release v${{ steps.set-package-version.outputs.version }}"
Expand Down
24 changes: 19 additions & 5 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,22 @@ on:
- main
paths:
- packages/react-native-gesture-handler/**
# For stable releases
# For manual releases
workflow_dispatch:
inputs:
release-type:
description: Type of release to publish.
type: choice
options:
- stable
- beta
- rc
default: stable
version:
description: Specific version to publish (usually inferred from x.y-stable branch name).
type: string
required: false
default: ''
dry-run:
description: Whether to perform a dry run of the publish.
type: boolean
Expand All @@ -31,16 +44,17 @@ jobs:
- name: Check out
uses: actions/checkout@v4

- name: Publish stable release
- name: Publish manual release
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: ./.github/actions/publish-npm-package
with:
is-commitly: false
release-type: ${{ inputs.release-type }}
version: ${{ inputs.version }}
dry-run: ${{ inputs.dry-run }}

- name: Publish commitly release
- name: Publish automatic commitly release
if: ${{ github.event_name == 'push' }}
uses: ./.github/actions/publish-npm-package
with:
is-commitly: true
release-type: 'commitly'
dry-run: false
43 changes: 43 additions & 0 deletions .github/workflows/run-jest-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Run Jest tests

on:
pull_request:
paths:
- '**/*.js'
- '**/*.jsx'
- '**/*.ts'
- '**/*.tsx'
push:
branches:
- main
workflow_dispatch:

jobs:
build:
if: github.repository == 'software-mansion/react-native-gesture-handler'

runs-on: ubuntu-latest
concurrency:
group: jest-${{ github.ref }}
cancel-in-progress: true

steps:
- name: checkout
uses: actions/checkout@v4

- name: Use Node.js 24
uses: actions/setup-node@v6
with:
node-version: 24
cache: yarn

- name: Install node dependencies
run: yarn --immutable

- name: Run jest scripts tests
run: yarn test:scripts

- name: Run jest package tests
# always run this step even if the previous step fails
if: ${{ always() }}
run: yarn workspace react-native-gesture-handler test
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"ts-check": "yarn workspaces foreach --all --parallel --topological-dev run ts-check",
"lint-js": "yarn workspaces foreach --all --parallel --topological-dev run lint-js",
"format-js": "yarn workspaces foreach --all --parallel --topological-dev run format-js",
"clean": "yarn workspaces foreach --all --parallel --topological-dev run clean && rm -rf node_modules yarn.lock"
"clean": "yarn workspaces foreach --all --parallel --topological-dev run clean && rm -rf node_modules yarn.lock",
"test:scripts": "jest ./scripts"
},
"devDependencies": {
"@types/react": "^19.0.12",
Expand All @@ -28,6 +29,7 @@
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.37.5",
"husky": "^8.0.1",
"jest": "^28.1.0",
"lint-staged": "^12.3.2",
"prettier": "3.3.3",
"typescript": "~5.8.3"
Expand Down
Loading