Skip to content

Commit 90d22a0

Browse files
committed
feat: workflow for OIDC publishing (#9095)
Adding integration with OIDC publishing action https://github.com/software-mansion/npm-package-publish, I made an upstream PR that tweaks the action so it applies to our monorepo releasing pipeline - software-mansion/npm-package-publish#7 I will update the releasing readme file in another PR, as I need this one merged to attach new screenshots etc. Release CI pass below
1 parent 6b58aea commit 90d22a0

12 files changed

Lines changed: 214 additions & 184 deletions
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: npm package publish
2+
on:
3+
workflow_call:
4+
inputs:
5+
package-name:
6+
description: 'Name of the package to publish - react-native-worklets or react-native-reanimated.'
7+
required: true
8+
type: string
9+
10+
package-json-path:
11+
description: 'Path to the package.json file of the package to be published.'
12+
required: true
13+
type: string
14+
15+
publish:
16+
description: 'Whether to publish the package or just do a dry run.'
17+
required: false
18+
type: boolean
19+
default: false
20+
21+
version:
22+
description: 'Version to be published if cannot be inferred automatically, use for stable releases.'
23+
required: false
24+
type: string
25+
default: ''
26+
27+
release-type:
28+
description: 'Release type to be published (stable, nightly, beta, rc)'
29+
type: string
30+
required: true
31+
32+
npm-tag:
33+
description: 'npm tag to publish under (usually inferred from release type and version)'
34+
required: false
35+
type: string
36+
default: ''
37+
38+
jobs:
39+
publish:
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
45+
- name: Use Node.js
46+
uses: actions/setup-node@v4
47+
with:
48+
cache: 'yarn'
49+
node-version: 22
50+
51+
- name: Build and publish ${{ inputs.package-name }}
52+
uses: software-mansion/npm-package-publish@264013301cc21350186b190f1f6dd10ae4c8ee04
53+
with:
54+
package-name: ${{ inputs.package-name }}
55+
package-json-path: ${{ inputs.package-json-path }}
56+
release-type: ${{ inputs.release-type || 'nightly' }}
57+
version: ${{ inputs.version }}
58+
npm-tag: ${{ inputs.npm-tag }}
59+
dry-run: ${{ !inputs.publish }}
60+
version-getter-script: 'scripts/resolve-release-version.js'
61+
perform-git-operations: 'false'

.github/workflows/npm-worklets-package-build.yml

Lines changed: 0 additions & 110 deletions
This file was deleted.

.github/workflows/npm-worklets-publish-nightly.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: npm worklets publish
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- '.github/workflows/npm-worklets-publish.yml'
8+
- '.github/workflows/npm-package-publish.yml'
9+
- '.github/actions/npm-package-publish/**'
10+
pull_request:
11+
paths:
12+
- '.github/workflows/npm-worklets-publish.yml'
13+
- '.github/workflows/npm-package-publish.yml'
14+
- '.github/actions/npm-package-publish/**'
15+
merge_group:
16+
branches:
17+
- main
18+
workflow_dispatch:
19+
inputs:
20+
publish:
21+
description: 'Whether to publish the package or just do a dry run.'
22+
required: false
23+
type: boolean
24+
default: false
25+
26+
version:
27+
description: 'Version to be published if cannot be inferred automatically, use for stable releases.'
28+
required: false
29+
type: string
30+
default: ''
31+
32+
release-type:
33+
description: 'Release type to be published (stable, nightly, beta, rc)'
34+
type: string
35+
required: true
36+
37+
npm-tag:
38+
description: 'npm tag to publish under (usually inferred from release type and version)'
39+
required: false
40+
type: string
41+
default: ''
42+
schedule:
43+
- cron: '27 23 * * *' # at 23:27 every day
44+
45+
jobs:
46+
npm-worklets-publish:
47+
uses: ./.github/workflows/npm-package-publish.yml
48+
with:
49+
package-name: 'react-native-worklets'
50+
package-json-path: 'packages/react-native-worklets/package.json'
51+
release-type: ${{ github.event_name == 'schedule' && 'nightly' || inputs.release-type || 'nightly' }}
52+
version: ${{ inputs.version }}
53+
npm-tag: ${{ inputs.npm-tag }}
54+
publish: ${{ inputs.publish || false }}

packages/react-native-worklets/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ React Native Worklets is a library that allows you to run JavaScript code in par
66

77
## Nightly CI state
88

9-
[![NPM Worklets publish [Nightly]](https://github.com/software-mansion/react-native-reanimated/actions/workflows/npm-worklets-publish-nightly.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/npm-worklets-publish-nightly.yml)
9+
[![NPM Worklets publish [Nightly]](https://github.com/software-mansion/react-native-reanimated/actions/workflows/npm-worklets-publish.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/npm-worklets-publish.yml)
1010
[![Lint clang-tidy [Nightly]](https://github.com/software-mansion/react-native-reanimated/actions/workflows/lint-clang-tidy-nightly.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/lint-clang-tidy-nightly.yml)
1111
[![Expo DevClient build check](https://github.com/software-mansion/react-native-reanimated/actions/workflows/expo-devclient-build-check-nightly.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/expo-devclient-build-check-nightly.yml)
1212
[![Worklets Bundle Mode build check [Nightly]](https://github.com/software-mansion/react-native-reanimated/actions/workflows/worklets-bundle-mode-build-check-nightly.yml/badge.svg)](https://github.com/software-mansion/react-native-reanimated/actions/workflows/worklets-bundle-mode-build-check-nightly.yml)

packages/react-native-worklets/createNPMPackage.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
yarn install --immutable
44

55
if [ $# -ge 1 ]; then
6-
if ! CURRENT_VERSION=$(node scripts/set-worklets-version.js "$@"); then
6+
if ! CURRENT_VERSION=$(node scripts/set-version.js "$@"); then
77
exit 1
88
fi
99
fi
@@ -13,7 +13,7 @@ yarn build
1313
npm pack
1414

1515
if [ $# -ge 1 ]; then
16-
node scripts/set-worklets-version.js "$CURRENT_VERSION" >/dev/null
16+
node scripts/set-version.js --version "$CURRENT_VERSION" >/dev/null
1717
fi
1818

1919
echo "Done!"

packages/react-native-worklets/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"worklets"
1010
],
1111
"scripts": {
12-
"build": "yarn workspace babel-plugin-worklets build && bob build && yarn build:unpackers",
12+
"build": "yarn workspace babel-plugin-worklets build && yarn set-version && bob build && yarn build:unpackers",
1313
"build:unpackers": "NODE_ENV='production' node ./scripts/export-unpackers.js",
1414
"circular-dependency-check": "yarn madge --extensions js,jsx --circular lib",
1515
"find-unused-code:js": "knip",
@@ -30,6 +30,7 @@
3030
"lint:clang-tidy": "find Common -iname \"*.h\" -o -iname \"*.cpp\" | xargs ../../scripts/clang-tidy-lint.sh",
3131
"lint:js": "eslint src && yarn prettier --check src",
3232
"lint:plugin": "yarn workspace babel-plugin-worklets lint",
33+
"set-version": "node scripts/set-version.js",
3334
"test": "jest",
3435
"type:check": "yarn type:check:src:native && yarn type:check:src:web && yarn type:check:plugin && yarn type:check:app && yarn type:check:tests",
3536
"type:check:src:native": "yarn tsc --noEmit",
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const path = require('path');
2+
const { setVersion } = require('../../../scripts/set-version');
3+
4+
const packageJsonPath = path.resolve(__dirname, '../package.json');
5+
const jsVersionPath = path.resolve(__dirname, '../src/debug/jsVersion.ts');
6+
7+
setVersion(packageJsonPath, jsVersionPath);

packages/react-native-worklets/scripts/set-worklets-version.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)