From 7f981258d0fd4080554c83ec67f88c4ff71d750f Mon Sep 17 00:00:00 2001 From: Alok Kumar Date: Sun, 15 Jun 2025 00:07:15 +0530 Subject: [PATCH 1/2] IV-1.1.3 [RELEASE] -> added build modes & testing coverage. --- .github/workflows/ci.yml | 47 +++++++++++++++++++++++++++++++ .github/workflows/publish-npm.yml | 30 ++++++++++++++++++++ .github/workflows/publish.yml | 26 ++++++++++------- package.json | 2 +- 4 files changed, 94 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/publish-npm.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a7983bd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,47 @@ +name: Test + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run tests + run: npm test + + - name: Run Build + run: npm build + + - name: Cleanup + if: always() + run: | + rm -rf node_modules + rm -rf dist + rm -rf coverage + rm -rf .nyc_output + rm -f package-lock.json + rm -f yarn.lock + rm -f pnpm-lock.yaml + rm -f .npmrc + rm -f .yarnrc + rm -f .pnpmrc + rm -f .env* + rm -f *.log + rm -f .DS_Store + rm -f Thumbs.db diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml new file mode 100644 index 0000000..fc3219a --- /dev/null +++ b/.github/workflows/publish-npm.yml @@ -0,0 +1,30 @@ +name: Publish Over NPM + +on: + release: + types: [ created ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org/' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Publish to NPM + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index df13ccc..6e71bef 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,12 +1,15 @@ -name: Publish Package to NPM +name: Publish Over Github Packages on: release: - types: [created] + types: [ created ] jobs: - build-and-publish: + build: runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - name: Checkout code uses: actions/checkout@v4 @@ -15,18 +18,21 @@ jobs: uses: actions/setup-node@v4 with: node-version: '20.x' - registry-url: 'https://registry.npmjs.org' + registry-url: 'https://npm.pkg.github.com' + scope: '@th3hero' - name: Install dependencies run: npm ci - - name: Run tests - run: npm test - - name: Build run: npm run build - - name: Publish to NPM - run: npm publish + - name: Create .npmrc file + run: | + echo "@th3hero:registry=https://npm.pkg.github.com/" >> .npmrc + echo "//npm.pkg.github.com/:_authToken=${{secrets.GITHUB_TOKEN}}" >> .npmrc + + - name: Publish to GitHub Packages + run: npm publish --access public env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} \ No newline at end of file diff --git a/package.json b/package.json index f1fee5a..654e380 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@th3hero/input-validator", - "version": "1.1.2", + "version": "1.1.3", "type": "module", "description": "A validation module for frontend in react.js & next.js where we will be validating the user input as per the requirement weather they are required, string, integer, boolean etc. with state management for errors in useState purely built on typescript.", "main": "dist/index.js", From 29eeca47b96a1a8c27b78bfc6ad4bc0922cdcaa5 Mon Sep 17 00:00:00 2001 From: Alok Kumar Date: Sun, 15 Jun 2025 00:10:27 +0530 Subject: [PATCH 2/2] IV-1.1.3 [RELEASE] - fixed ci failure. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a7983bd..e9a4482 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: run: npm test - name: Run Build - run: npm build + run: npm run build - name: Cleanup if: always()