name: Publish React Native Plugin on: workflow_call: inputs: repository: description: 'sdk repository, defaults to current repository' required: false type: string ref: description: 'commit/tag/branch reference' required: true type: string package-version: description: 'version for the npm package (MAJOR.MINOR.BUILD)' required: true type: string publish: description: 'value indicating whether to publish to npm.' required: true type: boolean default: false secrets: NPM_TOKEN: description: 'access token for npm publish' required: true jobs: build-package: runs-on: ubuntu-latest steps: - name: Checkout breez-liquid-sdk repo uses: actions/checkout@v3 with: repository: ${{ inputs.repository || github.repository }} ref: ${{ inputs.ref || github.sha }} - name: Setup node uses: actions/setup-node@v4 with: node-version: 20 registry-url: 'https://registry.npmjs.org' scope: '@breeztech' - name: Make sure we publish the version as specified working-directory: packages/react-native run: npm --no-git-tag-version --allow-same-version version ${{ inputs.package-version || '0.0.2' }} - name: Install dependencies working-directory: packages/react-native run: yarn - name: Pack for archival working-directory: packages/react-native run: yarn pack --filename breez-liquid-sdk-react-native.tgz - name: Archive the package uses: actions/upload-artifact@v3 with: name: react-native-${{ inputs.package-version || '0.0.2' }} path: packages/react-native/breez-liquid-sdk-react-native.tgz - name: Publish package to npm if: ${{ inputs.publish }} working-directory: packages/react-native env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} run: yarn publish