Skip to content

Commit c2eafb8

Browse files
author
huhuhang
committed
support npm
1 parent 0638bc5 commit c2eafb8

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish to NPM
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
release:
7+
types: [created]
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '18'
20+
registry-url: 'https://registry.npmjs.org'
21+
22+
- name: Verify package version
23+
run: |
24+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
25+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
26+
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
27+
echo "Package version ($PACKAGE_VERSION) does not match tag version ($TAG_VERSION)"
28+
exit 1
29+
fi
30+
if: github.event_name == 'push'
31+
32+
- name: Publish to NPM
33+
run: npm publish
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.npmignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.git
2+
.github
3+
__pycache__
4+
*.pyc
5+
.DS_Store
6+
requirements.txt
7+
update_sitemap.py

package.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "@labex-labs/schema",
3+
"version": "1.0.0",
4+
"description": "JSON Schema definitions for LabEx lab and course configurations",
5+
"main": "index.json",
6+
"files": [
7+
"*.json",
8+
"README.md"
9+
],
10+
"scripts": {
11+
"test": "echo \"No test specified\""
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/labex-labs/schema.git"
16+
},
17+
"keywords": [
18+
"labex",
19+
"labex-labs",
20+
"schema",
21+
"json-schema",
22+
"validation",
23+
"configuration"
24+
],
25+
"author": "LabEx",
26+
"license": "MIT",
27+
"homepage": "https://labex.io/",
28+
"bugs": {
29+
"url": "https://github.com/labex-labs/schema/issues"
30+
},
31+
"publishConfig": {
32+
"access": "public"
33+
}
34+
}

0 commit comments

Comments
 (0)