Skip to content

Commit

Permalink
feat: allow publishing to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
naftis committed Nov 5, 2024
1 parent 01432f6 commit 2e4ca51
Show file tree
Hide file tree
Showing 9 changed files with 441 additions and 6 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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: "16"
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('./packages/country-config/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: Publish to npm
if: steps.check-version.outputs.version-exists == 'false'
run: npm publish
working-directory: packages/country-config
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions packages/country-config/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!build
4 changes: 2 additions & 2 deletions packages/country-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@opencrvs-mosip/country-config",
"version": "1.0.0",
"name": "@opencrvs/mosip",
"version": "1.7.0-alpha.1",
"license": "MPL-2.0",
"main": "./build/index.js",
"exports": {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/country-config/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from "./form-definitions";
export * from "./forms";
export * from "./events";
Loading

0 comments on commit 2e4ca51

Please sign in to comment.