Skip to content

Commit 58ef889

Browse files
authored
Merge pull request #65 from namecheap/feature/publish-package
ci: publish npm package
2 parents e636912 + f83c243 commit 58ef889

File tree

9 files changed

+12376
-5080
lines changed

9 files changed

+12376
-5080
lines changed

.github/workflows/ci.yml

Lines changed: 70 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,76 @@
11
name: CI
22

33
on:
4-
push:
5-
branches:
6-
- master
7-
tags-ignore:
8-
- "**"
9-
pull_request:
10-
branches:
11-
- "**"
4+
push:
5+
branches:
6+
- master
7+
tags-ignore:
8+
- '**'
9+
pull_request:
10+
branches:
11+
- '**'
1212

1313
jobs:
14-
build:
15-
name: Build
16-
runs-on: ubuntu-latest
14+
build:
15+
name: Build
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
node-version: [16.x, 18.x, 20.x]
20+
steps:
21+
- uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v4
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
cache: 'npm'
29+
- run: npm ci
30+
- if: github.event_name == 'pull_request'
31+
name: Lint commit messages
32+
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
33+
- run: npm run format:check
34+
- run: npm run lint
35+
- run: npm run build
36+
- run: npm run coverage
37+
- if: matrix.node-version == '20.x'
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: Code coverage
41+
path: coverage/
42+
- if: matrix.node-version == '20.x'
43+
run: npm run docs
44+
- if: matrix.node-version == '20.x'
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: Documentation
48+
path: docs/
1749

18-
strategy:
19-
matrix:
20-
node-version: [16.x, 18.x, 20.x]
21-
22-
steps:
23-
- uses: actions/checkout@v3
24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v3
26-
with:
27-
node-version: ${{ matrix.node-version }}
28-
cache: 'npm'
29-
- run: npm ci
30-
- run: npm run format:check
31-
- run: npm run lint
32-
- run: npm run build
33-
- run: npm run coverage
34-
- if: matrix.node-version == '20.x'
35-
uses: actions/upload-artifact@v3
36-
with:
37-
name: Code coverage
38-
path: coverage/
39-
- if: matrix.node-version == '20.x'
40-
run: npm run docs
41-
- if: matrix.node-version == '20.x'
42-
uses: actions/upload-artifact@v3
43-
with:
44-
name: Documentation
45-
path: docs/
46-
- name: Deploy Docs
47-
if: github.ref == 'refs/heads/master' && matrix.node-version == '20.x'
48-
uses: peaceiris/actions-gh-pages@v3
49-
with:
50-
github_token: ${{ secrets.GITHUB_TOKEN }}
51-
publish_dir: ./docs
50+
publish:
51+
name: 'Publish'
52+
needs: build
53+
runs-on: ubuntu-latest
54+
environment: npm_publish
55+
if: github.ref == 'refs/heads/master'
56+
steps:
57+
- uses: actions/download-artifact@v4
58+
with:
59+
name: Documentation
60+
path: docs/
61+
- name: Deploy Docs
62+
uses: peaceiris/actions-gh-pages@v4
63+
with:
64+
github_token: ${{ secrets.GITHUB_TOKEN }}
65+
publish_dir: ./docs
66+
- uses: actions/checkout@v4
67+
- uses: actions/setup-node@v4
68+
with:
69+
node-version: 20.x
70+
cache: 'npm'
71+
- run: npm ci
72+
- name: Publish new version
73+
env:
74+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
75+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
run: npx semantic-release

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
npx --no -- commitlint --edit $1

.husky/pre-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
npx lint-staged
2+
npm run build
3+
npm test

README.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# App development SDK for ILC
2+
23
[![NPM package](https://badgen.net/npm/v/ilc-sdk?color=red&icon=npm&label=)](https://www.npmjs.com/package/ilc-sdk)
34
[![NPM downloads](https://badgen.net/npm/dt/ilc-sdk)](https://www.npmjs.com/package/ilc-sdk)
45

@@ -12,17 +13,22 @@ $ npm i ilc-sdk
1213

1314
## Documentation
1415

15-
* JS docs https://namecheap.github.io/ilc-sdk/
16-
* Additional materials
17-
* [ILC to App interface](https://namecheap.github.io/ilc-sdk/pages/Pages/ilc_app_interface.html)
18-
* [ILC Global API](https://namecheap.github.io/ilc-sdk/pages/Pages/global_api.html)
19-
* [Registry API](https://namecheap.github.io/ilc-sdk/pages/Pages/registry_api.html)
20-
* [Public Path Problem](https://namecheap.github.io/ilc-sdk/pages/Pages/public_path.html)
16+
- JS docs https://namecheap.github.io/ilc-sdk/
17+
- Additional materials
18+
- [ILC to App interface](https://namecheap.github.io/ilc-sdk/pages/Pages/ilc_app_interface.html)
19+
- [ILC Global API](https://namecheap.github.io/ilc-sdk/pages/Pages/global_api.html)
20+
- [Registry API](https://namecheap.github.io/ilc-sdk/pages/Pages/registry_api.html)
21+
- [Public Path Problem](https://namecheap.github.io/ilc-sdk/pages/Pages/public_path.html)
2122

2223
## Node.js and App entrypoints
2324

2425
This package features 2 bundles that are intended to be used in Node.js app that runs SSR bundle of your app and
2526
the application itself.
2627

27-
* Node.js server bundle - [documentation](https://namecheap.github.io/ilc-sdk/modules/server.html)
28-
* Application bundle - [documentation](https://namecheap.github.io/ilc-sdk/modules/app.html)
28+
- Node.js server bundle - [documentation](https://namecheap.github.io/ilc-sdk/modules/server.html)
29+
- Application bundle - [documentation](https://namecheap.github.io/ilc-sdk/modules/app.html)
30+
31+
## Contribution
32+
33+
- Commit messages must follow the [conventional commits specification](https://www.conventionalcommits.org/en/v1.0.0/#specification)
34+
- This library follows [semantic versioning](https://semver.org/)

commitlint.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* @type {import('@commitlint/types').UserConfig}
3+
*/
4+
module.exports = {
5+
extends: ['@commitlint/config-conventional'],
6+
};

lint-staged.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* @type {import('lint-staged').Config}
3+
*/
4+
module.exports = {
5+
'*': 'prettier --ignore-unknown --write',
6+
'*.ts': 'npm run lint -- --fix',
7+
};

0 commit comments

Comments
 (0)