|
1 | 1 | name: Publish |
2 | 2 | on: |
| 3 | + # For nightly releases |
| 4 | + schedule: |
| 5 | + - cron: '42 23 * * *' # at 23:42 every day |
| 6 | + # For manual releases |
3 | 7 | workflow_dispatch: |
4 | 8 | inputs: |
5 | | - dryRun: |
6 | | - description: 'Set to true to perform a dry run' |
| 9 | + release-type: |
| 10 | + description: Type of release to publish. |
| 11 | + type: choice |
| 12 | + options: [stable, nightly, beta, rc] |
| 13 | + default: stable |
| 14 | + version: |
| 15 | + description: Specific version to publish (usually inferred from x.y-stable branch name). |
| 16 | + type: string |
7 | 17 | required: false |
8 | | - default: 'true' |
9 | | - |
10 | | -permissions: |
11 | | - id-token: write |
12 | | - contents: read |
| 18 | + default: '' |
| 19 | + dry-run: |
| 20 | + description: Whether to perform a dry run of the publish. |
| 21 | + type: boolean |
| 22 | + default: true |
13 | 23 |
|
14 | 24 | jobs: |
15 | | - verify-and-publish: |
| 25 | + publish: |
16 | 26 | runs-on: ubuntu-latest |
17 | | - environment: production |
18 | | - steps: |
19 | | - - name: Checkout |
20 | | - uses: actions/checkout@v4 |
21 | | - |
22 | | - - name: Setup |
23 | | - uses: ./.github/actions/setup |
24 | | - |
25 | | - - name: Run ESLint (JS/TS check) |
26 | | - run: yarn lint |
27 | | - |
28 | | - - name: Typecheck files |
29 | | - run: yarn typecheck |
30 | | - |
31 | | - - name: Run clang-format (C/C++ check) |
32 | | - run: yarn lint-clang |
33 | 27 |
|
34 | | - - name: Run android lint (Kotlin/Java/Groovy check) |
35 | | - run: yarn lint:android |
| 28 | + permissions: |
| 29 | + contents: write |
| 30 | + id-token: write # for OIDC |
36 | 31 |
|
37 | | - - name: Run unit tests |
38 | | - run: yarn test --maxWorkers=2 --coverage |
| 32 | + concurrency: |
| 33 | + group: publish-${{ github.ref }} |
| 34 | + cancel-in-progress: false |
39 | 35 |
|
40 | | - - name: Build package |
41 | | - run: npm pack |
| 36 | + steps: |
| 37 | + - name: Check out |
| 38 | + uses: actions/checkout@v4 |
42 | 39 |
|
43 | | - - name: Get metadata |
44 | | - id: meta |
| 40 | + - name: Set up environment |
| 41 | + shell: bash |
45 | 42 | run: | |
46 | | - NAME=$(jq -r .name package.json) |
47 | | - VERSION=$(jq -r .version package.json) |
48 | | - FILENAME="${NAME}-${VERSION}.tgz" |
49 | | - echo "PACKAGE_NAME=$FILENAME" >> $GITHUB_OUTPUT |
50 | | - echo "Artifact filename: $FILENAME" |
| 43 | + echo "YARN_ENABLE_HARDENED_MODE=0" >> $GITHUB_ENV |
51 | 44 |
|
52 | | - - name: Upload NPM tarball as artifact |
53 | | - uses: actions/upload-artifact@v4 |
| 45 | + - name: Setup Node |
| 46 | + uses: actions/setup-node@v6 |
54 | 47 | with: |
55 | | - name: ${{ steps.meta.outputs.PACKAGE_NAME }} |
56 | | - path: ${{ steps.meta.outputs.PACKAGE_NAME }} |
57 | | - overwrite: true |
58 | | - if-no-files-found: error |
| 48 | + node-version: 24 |
| 49 | + cache: 'yarn' |
| 50 | + registry-url: https://registry.npmjs.org/ |
59 | 51 |
|
60 | | - - name: Publish package (dry-run) |
61 | | - if: ${{ github.event.inputs.dryRun == 'true' }} |
62 | | - run: | |
63 | | - echo "Dry run enabled — skipping actual publish" |
64 | | - npm publish --dry-run |
| 52 | + - name: Publish manual release |
| 53 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 54 | + uses: software-mansion/npm-package-publish@1bb885ec49bed729c8c1ec95a11a285d89f1bf45 |
| 55 | + with: |
| 56 | + package-name: 'react-native-enriched' |
| 57 | + package-json-path: 'packages/react-native-enriched/package.json' |
| 58 | + install-dependencies-command: 'yarn install --immutable' |
| 59 | + release-type: ${{ inputs.release-type }} |
| 60 | + version: ${{ inputs.version }} |
| 61 | + dry-run: ${{ inputs.dry-run }} |
65 | 62 |
|
66 | | - - name: Publish package |
67 | | - if: ${{ github.event.inputs.dryRun != 'true' }} |
68 | | - run: | |
69 | | - echo "Publishing package..." |
70 | | - npm publish |
| 63 | + - name: Publish automatic nightly release |
| 64 | + if: ${{ github.event_name == 'schedule' }} |
| 65 | + uses: software-mansion/npm-package-publish@1bb885ec49bed729c8c1ec95a11a285d89f1bf45 |
| 66 | + with: |
| 67 | + package-name: 'react-native-enriched' |
| 68 | + package-json-path: 'packages/react-native-enriched/package.json' |
| 69 | + install-dependencies-command: 'yarn install --immutable' |
| 70 | + release-type: 'nightly' |
| 71 | + dry-run: false |
0 commit comments