Skip to content

Commit 7f98125

Browse files
committed
IV-1.1.3 [RELEASE] -> added build modes & testing coverage.
1 parent 68af5ca commit 7f98125

4 files changed

Lines changed: 94 additions & 11 deletions

File tree

.github/workflows/ci.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20.x'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Run tests
26+
run: npm test
27+
28+
- name: Run Build
29+
run: npm build
30+
31+
- name: Cleanup
32+
if: always()
33+
run: |
34+
rm -rf node_modules
35+
rm -rf dist
36+
rm -rf coverage
37+
rm -rf .nyc_output
38+
rm -f package-lock.json
39+
rm -f yarn.lock
40+
rm -f pnpm-lock.yaml
41+
rm -f .npmrc
42+
rm -f .yarnrc
43+
rm -f .pnpmrc
44+
rm -f .env*
45+
rm -f *.log
46+
rm -f .DS_Store
47+
rm -f Thumbs.db

.github/workflows/publish-npm.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish Over NPM
2+
3+
on:
4+
release:
5+
types: [ created ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '20.x'
19+
registry-url: 'https://registry.npmjs.org/'
20+
21+
- name: Install dependencies
22+
run: npm ci
23+
24+
- name: Build
25+
run: npm run build
26+
27+
- name: Publish to NPM
28+
run: npm publish --access public
29+
env:
30+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.github/workflows/publish.yml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
1-
name: Publish Package to NPM
1+
name: Publish Over Github Packages
22

33
on:
44
release:
5-
types: [created]
5+
types: [ created ]
66

77
jobs:
8-
build-and-publish:
8+
build:
99
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
1013
steps:
1114
- name: Checkout code
1215
uses: actions/checkout@v4
@@ -15,18 +18,21 @@ jobs:
1518
uses: actions/setup-node@v4
1619
with:
1720
node-version: '20.x'
18-
registry-url: 'https://registry.npmjs.org'
21+
registry-url: 'https://npm.pkg.github.com'
22+
scope: '@th3hero'
1923

2024
- name: Install dependencies
2125
run: npm ci
2226

23-
- name: Run tests
24-
run: npm test
25-
2627
- name: Build
2728
run: npm run build
2829

29-
- name: Publish to NPM
30-
run: npm publish
30+
- name: Create .npmrc file
31+
run: |
32+
echo "@th3hero:registry=https://npm.pkg.github.com/" >> .npmrc
33+
echo "//npm.pkg.github.com/:_authToken=${{secrets.GITHUB_TOKEN}}" >> .npmrc
34+
35+
- name: Publish to GitHub Packages
36+
run: npm publish --access public
3137
env:
32-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
38+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@th3hero/input-validator",
3-
"version": "1.1.2",
3+
"version": "1.1.3",
44
"type": "module",
55
"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.",
66
"main": "dist/index.js",

0 commit comments

Comments
 (0)