Skip to content

Commit

Permalink
ci: workflow publish
Browse files Browse the repository at this point in the history
  • Loading branch information
baicie committed Jan 3, 2024
1 parent d7527cf commit 4b5bb42
Show file tree
Hide file tree
Showing 12 changed files with 948 additions and 20 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish to NPM registry

on:
release:
types: [created]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.com/

- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
with:
version: 8.2.0

- name: Get version
run: echo "TAG_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Get git head
run: echo "GIT_HEAD=${GITHUB_SHA}" >> $GITHUB_ENV

- name: Gen npmrc
run: echo "//registry.npmjs.com/:_authToken=${{ secrets.NPM_PUBLISH_TOKEN }}" >> ./.npmrc

- name: who am i
run: npm who am i

- name: Build&publish
run: sh ./scripts/publish.sh
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}
TAG_VERSION: ${{env.TAG_VERSION}}
GIT_HEAD: ${{env.GIT_HEAD}}
REGISTRY: https://registry.npmjs.com/
NODE_OPTIONS: --max-old-space-size=4096
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
"build": "turbo run build",
"dev": "turbo run dev",
"lint-fix": "eslint ./packages ./scripts --fix",
"ox-fix": "oxlint --fix"
"update-version": "tsx scripts/update-version.ts",
"publish-script": "tsx scripts/publish-script.ts"
},
"devDependencies": {
"@antfu/eslint-config": "0.41.0",
"@b-reader/utils": "workspace:^",
"@baicie/commitizen": "^0.1.0",
"@pnpm/find-workspace-packages": "^6.0.9",
"@types/archiver": "^6.0.2",
"@types/i18n": "^0.13.10",
"@types/lodash": "^4.14.202",
Expand Down Expand Up @@ -45,5 +47,6 @@
"vite": "^5.0.10",
"vue": "^3.3.13",
"vue-tsc": "^1.8.26"
}
},
"version": "0.0.0"
}
4 changes: 2 additions & 2 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"vue-i18n": "^9.8.0",
"xml2js": "^0.6.2"
},
"buildOptions": {
"type": "private"
"config": {
"publish": false
}
}
8 changes: 6 additions & 2 deletions packages/epub/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@b-reader/epub",
"version": "1.0.0",
"version": "0.0.0",
"description": "",
"author": "",
"license": "ISC",
Expand All @@ -12,9 +12,13 @@
"dev": "pnpm run build --watch",
"test": "pnpm tsx ./src/test.ts"
},
"dependencies": {
"dependencies": {
"lodash": "^4.17.21",
"unzipper": "^0.10.14",
"xml2js": "^0.6.2"
},
"config": {
"type": "package",
"publish": true
}
}
15 changes: 8 additions & 7 deletions packages/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"publisher": "baicie",
"name": "b-reader",
"displayName": "b-reader",
"version": "0.0.1",
"version": "0.0.0",
"description": "read more book",
"author": {
"email": "zl316546@gmail.com",
Expand Down Expand Up @@ -73,18 +73,19 @@
"scripts": {
"vscode:prepublish": "pnpm tsup",
"build": "pnpm vsce package --no-dependencies",
"dev": "pnpm run code-debug && pnpm cross-env NODE_ENV=production pnpm tsup --watch",
"lint": "eslint src --ext ts",
"dev": "pnpm run code-debug && pnpm cross-env NODE_ENV=production pnpm tsup --watch",
"lint": "eslint src --ext ts",
"code-debug": "tsx ../../scripts/run-code.ts"
},
"dependencies": {
"@b-reader/epub": "workspace:^",
"@b-reader/epub": "workspace:^",
"@b-reader/utils": "workspace:^",
"file-type": "^18.7.0",
"lowdb": "^6.1.1",
"uuid": "^9.0.1"
},
"buildOptions": {
"type": "vscode"
"config": {
"type": "extension",
"publish": false
}
}
}
6 changes: 5 additions & 1 deletion packages/pdf/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@b-reader/pdf",
"version": "1.0.0",
"version": "0.0.0",
"description": "",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand All @@ -13,5 +13,9 @@
"license": "ISC",
"dependencies": {
"pdf2json": "^3.0.5"
},
"config": {
"type": "package",
"publish": true
}
}
7 changes: 4 additions & 3 deletions packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@b-reader/utils",
"version": "1.0.0",
"version": "0.0.0",
"private": false,
"description": "",
"author": "",
Expand All @@ -15,7 +15,8 @@
"dependencies": {
"fast-glob": "^3.3.2"
},
"buildOptions": {
"type": "npm"
"config": {
"type": "package",
"publish": true
}
}
Loading

0 comments on commit 4b5bb42

Please sign in to comment.