Build nightly and publish on npm #228
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: Build nightly and publish on npm | |
| env: | |
| YARN_ENABLE_HARDENED_MODE: 0 | |
| on: | |
| schedule: | |
| - cron: '27 23 * * *' # at 23:27 every day | |
| workflow_dispatch: | |
| jobs: | |
| npm-build: | |
| if: github.repository == 'software-mansion/react-native-screens' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # for OIDC | |
| env: | |
| PACKAGE_NAME: PLACEHOLDER # Will be reassigned later on. | |
| steps: | |
| - name: Check out | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: 'yarn' | |
| registry-url: https://registry.npmjs.org/ | |
| # Ensure npm 11.5.1 or later is installed for OIDC | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - name: Clear annotations | |
| run: .github/workflows/helper/clear-annotations.sh | |
| - name: Install node dependencies | |
| run: yarn install --immutable | |
| - name: Build package | |
| id: build | |
| run: ./scripts/create-npm-package.sh | |
| - name: Add package name to env | |
| run: echo "PACKAGE_NAME=$(ls -l | egrep -o "react-native-screens-(.*)(=?\.tgz)")" >> $GITHUB_ENV | |
| - name: Assert PACKAGE_NAME | |
| if: ${{ env.PACKAGE_NAME == 'PLACEHOLDER' }} | |
| run: exit 1 # This should never happen. | |
| - name: Upload npm package to GitHub | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.PACKAGE_NAME }} | |
| path: './${{ env.PACKAGE_NAME }}' | |
| - name: Publish npm package | |
| run: npm publish $PACKAGE_NAME --tag nightly --provenance |