Skip to content

working on higher order component package #1

working on higher order component package

working on higher order component package #1

Workflow file for this run

name: Yarn Install and Publish
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org/'
- name: Load .env file if exists
run: |
if [ -f .env ]; then
set -a
source .env
set +a
fi
- name: Set Environment Variables with fallback to .env
run: |
echo "NPM_READ_TOKEN=${{ secrets.NPM_READ_TOKEN || env.NPM_READ_TOKEN }}" >> $GITHUB_ENV
echo "NPM_PUBLISH_TOKEN=${{ secrets.NPM_PUBLISH_TOKEN || env.NPM_PUBLISH_TOKEN }}" >> $GITHUB_ENV
- name: Install dependencies
run: yarn install
- name: Check and bump version if needed
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
CURRENT_VERSION=$(npm view $(node -p "require('./package.json').name") version)
LOCAL_VERSION=$(node -p "require('./package.json').version")
if [ "$CURRENT_VERSION" == "$LOCAL_VERSION" ]; then
npm version patch
fi
- name: Set up .npmrc for authentication
run: |
echo "@devlander:registry=https://registry.npmjs.org/" > ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${NPM_PUBLISH_TOKEN}" >> ~/.npmrc
- name: Debug - Display .npmrc
run: cat ~/.npmrc
continue-on-error: true
- name: Publish to npm
run: npm publish --access public