test what happens without checking if it already exists #3
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: Publish country-config 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: Install dependencies | |
run: yarn install | |
working-directory: packages/country-config | |
- name: Build | |
run: yarn build | |
working-directory: packages/country-config | |
# - 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." | |
# exit 0 | |
# else | |
# echo "Version $PACKAGE_VERSION does not exist on npm." | |
# fi | |
# working-directory: packages/country-config | |
- name: Authenticate to npm | |
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 }} |