Merge pull request #225 from velocitycareerlabs/VL-7885-fix-generateO… #79
This file contains 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: ReactNative-SDK | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: Configuration environment | |
required: true | |
default: 'dev' | |
type: choice | |
options: | |
- dev | |
- rc | |
- prod | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.sha }} | |
cancel-in-progress: true | |
env: | |
NODE_VERSION: '20' | |
RC_SUFFIX: 'rc' | |
GLOBAL_ENV: ${{ github.event_name == 'push' && format('{0}', 'dev') || inputs.environment }} | |
jobs: | |
build-react-native-sdk: | |
runs-on: macos-14 | |
steps: | |
- name: Git clone repository | |
uses: actions/checkout@v4 | |
# Setup Node.js | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
# Publish to npm | |
- name: Set NPM Packages Config | |
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | |
# Git Set Identity | |
- name: Git Identity | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
# Commit Version Locally for Github npm | |
- name: Commit Version Locally for Github npm | |
run: git add .npmrc && git commit -am "Prepare to release" | |
# Install dependencies | |
- name: Install dependencies | |
run: corepack enable && yarn set version 3.6.1 && yarn | |
# Build and Publish SDK | |
- name: Build and Publish SDK | |
if: ${{ env.GLOBAL_ENV == 'prod' || env.GLOBAL_ENV == 'rc' }} | |
run: npm publish --tag ${{ env.RELEASE_TAG }} --access public --userconfig ./.npmrc | |
env: | |
RELEASE_TAG: ${{ env.GLOBAL_ENV == 'prod' && format('{0}', 'latest' ) || env.RC_SUFFIX }} |