Skip to content

NPM Reanimated package build #10

NPM Reanimated package build

NPM Reanimated package build #10

name: NPM Reanimated package build
env:
YARN_ENABLE_HARDENED_MODE: 0
on:
workflow_call:
inputs:
option:
required: false
type: string
ref:
required: false
type: string
publish_on_npm:
required: false
type: boolean
secrets:
NODE_AUTH_TOKEN:
required: false
workflow_dispatch:
inputs:
option:
required: false
type: string
ref:
required: false
type: string
jobs:
build:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: ubuntu-latest
env:
PACKAGE_NAME: PLACEHOLDER # Will be reassigned later on.
steps:
- name: Check out
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Clear annotations
run: .github/workflows/helper/clear-annotations.sh
- name: Install monorepo node dependencies
run: yarn install --immutable
- name: Build package
working-directory: packages/react-native-reanimated
id: build
run: >-
./createNPMPackage.sh ${{ inputs.option }}
- name: Check if any node_modules were packed
working-directory: packages/react-native-reanimated
id: node_modules
run: >-
! grep --silent -E "node_modules/.+" build.log
- name: Show build log
working-directory: packages/react-native-reanimated
if: failure() && steps.build.outcome == 'failure'
run: >-
cat build.log
- name: Show packed node_modules
working-directory: packages/react-native-reanimated
if: failure() && steps.node_modules.outcome == 'failure'
run: >-
! grep -E "node_modules/.+" build.log
- name: Add package name to env
working-directory: packages/react-native-reanimated
run: echo "PACKAGE_NAME=$(ls -l | egrep -o "react-native-reanimated-(.*)(=?\.tgz)")" >> $GITHUB_ENV
- name: Upload npm package
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: 'packages/react-native-reanimated/${{ env.PACKAGE_NAME }}'
- name: Move package to repo root
working-directory: packages/react-native-reanimated
run: mv $PACKAGE_NAME ../../
- name: Publish npm package
run: npm publish $PACKAGE_NAME --tag nightly
if: ${{ inputs.publish_on_npm }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}