Publish release to npm #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish release to npm | |
| on: | |
| schedule: | |
| - cron: "27 23 * * *" # at 23:27 every day | |
| workflow_dispatch: | |
| inputs: | |
| dry-run: | |
| description: >- | |
| Whether to perform a dry run of the publish. | |
| Uncheck only to publish artifacts to the npm registry. | |
| type: boolean | |
| default: true | |
| release-type: | |
| description: Type of release to publish. | |
| type: choice | |
| options: | |
| - stable | |
| - nightly | |
| - beta | |
| - rc | |
| default: stable | |
| version: | |
| description: >- | |
| Specific version to publish. For stable: usually inferred from | |
| x.y-stable branch name. For nightly: leave empty to auto-infer | |
| from npm latest tag. | |
| type: string | |
| required: false | |
| default: "" | |
| jobs: | |
| npm-publish: | |
| if: github.repository == 'software-mansion/react-native-screens' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # for git operations on stable releases | |
| id-token: write # for OIDC | |
| concurrency: | |
| group: publish-${{ github.ref }} | |
| cancel-in-progress: false | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@v4 | |
| - name: Set up environment | |
| shell: bash | |
| run: echo "YARN_ENABLE_HARDENED_MODE=0" >> $GITHUB_ENV | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: "yarn" | |
| registry-url: https://registry.npmjs.org/ | |
| # Guards against publishing a stable / beta / rc release from an | |
| # inappropriate target. Intentionally skipped for nightly releases, | |
| # which are published from main by design. | |
| - name: Validate publish target | |
| if: ${{ github.event_name == 'workflow_dispatch' && inputs.release-type != 'nightly' }} | |
| shell: bash | |
| env: | |
| BRANCH: ${{ github.ref_name }} | |
| RELEASE_TYPE: ${{ inputs.release-type }} | |
| run: ./scripts/validate-publish-target.sh "$BRANCH" "$RELEASE_TYPE" | |
| - name: Publish manual release | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| uses: software-mansion/npm-package-publish@264013301cc21350186b190f1f6dd10ae4c8ee04 | |
| with: | |
| package-name: "react-native-screens" | |
| package-json-path: "package.json" | |
| install-dependencies-command: "yarn install --immutable" | |
| release-type: ${{ inputs.release-type }} | |
| version: ${{ inputs.version }} | |
| dry-run: ${{ inputs.dry-run }} | |
| perform-git-operations: false # We do it manually in more predictive manner | |
| - name: Publish automatic nightly release | |
| if: ${{ github.event_name == 'schedule' }} | |
| uses: software-mansion/npm-package-publish@264013301cc21350186b190f1f6dd10ae4c8ee04 | |
| with: | |
| package-name: "react-native-screens" | |
| package-json-path: "package.json" | |
| install-dependencies-command: "yarn install --immutable" | |
| release-type: "nightly" | |
| dry-run: false |