Skip to content

refactor: id reader components (#29) #78

refactor: id reader components (#29)

refactor: id reader components (#29) #78

Workflow file for this run

name: "🌐 Country-config toolkit: Publish to npm"
on:
push:
branches:
- main
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version-file: ".nvmrc"
registry-url: "https://registry.npmjs.org/"
- name: Check if version exists on npm
id: check-version
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
if npm view @opencrvs/mosip@$PACKAGE_VERSION > /dev/null 2>&1; then
echo "Version $PACKAGE_VERSION already exists on npm."
echo "version-exists=true" >> $GITHUB_OUTPUT
else
echo "Version $PACKAGE_VERSION does not exist on npm."
echo "version-exists=false" >> $GITHUB_OUTPUT
fi
working-directory: packages/country-config
- name: Install dependencies
if: steps.check-version.outputs.version-exists == 'false'
run: yarn install
working-directory: packages/country-config
- name: Build
if: steps.check-version.outputs.version-exists == 'false'
run: yarn build
working-directory: packages/country-config
- name: Authenticate to npm
if: steps.check-version.outputs.version-exists == 'false'
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
working-directory: packages/country-config
- name: Publish to npm
if: steps.check-version.outputs.version-exists == 'false'
run: npm publish --access public
working-directory: packages/country-config
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}