Skip to content

Commit b75bb5c

Browse files
authored
Add workflow for releases (#3760)
## Description This PR adds workflow that will publish new versions of **Gesture Handler** to `npm`. This is similar to [react-native-screens CI](https://github.com/software-mansion/react-native-screens/blob/15f83cf00b2d46c17c8e0f4c157c76f10bb57d53/.github/workflows/npm-screens-publish-nightly.yml), but this one will publish stable releases. > [!NOTE] > We will dive deeper and check how to make this CI publish both, nightly and stable releases. For now we need this for stable release, so we want to make sure it works without any problems. ## Test plan Downloaded artifact from CI.
1 parent 5cef081 commit b75bb5c

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build package and publish on npm
2+
env:
3+
YARN_ENABLE_HARDENED_MODE: 0
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
npm-build:
9+
if: github.repository == 'software-mansion/react-native-gesture-handler'
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write # for OIDC
14+
env:
15+
PACKAGE_NAME: PLACEHOLDER # Will be reassigned later on.
16+
steps:
17+
- name: Check out
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v6
22+
with:
23+
node-version: 24
24+
cache: 'yarn'
25+
registry-url: https://registry.npmjs.org/
26+
27+
# Ensure npm 11.5.1 or later is installed for OIDC
28+
- name: Update npm
29+
run: npm install -g npm@latest
30+
31+
- name: Install node dependencies
32+
run: yarn install --immutable
33+
34+
- name: Build package
35+
id: build
36+
working-directory: packages/react-native-gesture-handler
37+
run: npm pack
38+
39+
- name: Add package name to env
40+
working-directory: packages/react-native-gesture-handler
41+
run: echo "PACKAGE_NAME=$(ls -l | egrep -o "react-native-gesture-handler-(.*)(=?\.tgz)")" >> $GITHUB_ENV
42+
43+
- name: Assert PACKAGE_NAME
44+
if: ${{ env.PACKAGE_NAME == 'PLACEHOLDER' }}
45+
run: exit 1 # If we end up here, it means that package was not generated.
46+
47+
- name: Upload npm package to GitHub
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: ${{ env.PACKAGE_NAME }}
51+
path: './packages/react-native-gesture-handler/${{ env.PACKAGE_NAME }}'
52+
53+
- name: Publish npm package
54+
run: npm publish $PACKAGE_NAME --provenance

0 commit comments

Comments
 (0)