Skip to content

Commit f21c963

Browse files
committed
feat: implement CI/CD workflow and update package version to 1.0.29
1 parent 482486e commit f21c963

File tree

3 files changed

+99
-60
lines changed

3 files changed

+99
-60
lines changed

.github/workflows/ci.yaml

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Continuous Integration and Deployment
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
deployments: write
11+
packages: write
12+
checks: write
13+
statuses: write
14+
pull-requests: write
15+
issues: write
16+
17+
jobs:
18+
lint-and-test:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v3
23+
24+
- name: Setup Node.js and cache PNPM dependencies
25+
uses: actions/setup-node@v3
26+
with:
27+
node-version: "20.8"
28+
cache: pnpm
29+
30+
- name: Install PNPM
31+
uses: pnpm/action-setup@v2
32+
with:
33+
version: 8
34+
35+
- name: Install Dependencies
36+
run: pnpm install
37+
env:
38+
CI: true
39+
40+
- name: Run Linting
41+
run: pnpm lint:ci
42+
43+
- name: Run Type Check
44+
run: pnpm types:check
45+
46+
- name: Run Tests
47+
run: pnpm test:ci
48+
49+
publish-npm:
50+
needs: [lint-and-test]
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Checkout repository
54+
uses: actions/checkout@v3
55+
56+
- name: Setup Node.js and cache PNPM dependencies
57+
uses: actions/setup-node@v3
58+
with:
59+
node-version: "20.8"
60+
registry-url: "https://registry.npmjs.org"
61+
scope: "@programmer_network"
62+
cache: pnpm
63+
64+
- name: Install PNPM
65+
uses: pnpm/action-setup@v2
66+
with:
67+
version: 8
68+
69+
- name: Install Dependencies
70+
run: pnpm install
71+
env:
72+
CI: true
73+
74+
- name: Build the Code
75+
run: pnpm build
76+
77+
- name: Verify NPM_TOKEN is set
78+
run: |
79+
if [ -z "${{ secrets.NPM_TOKEN }}" ]; then
80+
echo "NPM_TOKEN secret is not set! Failing the build."
81+
exit 1
82+
fi
83+
84+
- name: Set up Git Identity
85+
run: |
86+
git config --global user.name "GitHub Actions"
87+
git config --global user.email "actions@github.com"
88+
89+
- name: Create Release Draft
90+
uses: "marvinpinto/action-automatic-releases@latest"
91+
with:
92+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
93+
prerelease: false
94+
95+
- name: Publish to NPM
96+
run: pnpm publish --no-git-checks
97+
env:
98+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/lint-and-test.yaml

-59
This file was deleted.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@programmer_network/use-ajv-form",
3-
"version": "1.0.28",
3+
"version": "1.0.29",
44
"description": "Custom React Hook that integrates with Ajv JSON Schema Validator",
55
"main": "dist/use-ajv-form.es.js",
66
"author": "Aleksandar Grbic",

0 commit comments

Comments
 (0)