Skip to content

Commit 4fa6b52

Browse files
committed
fix: publish docs
1 parent fe88d62 commit 4fa6b52

3 files changed

Lines changed: 78 additions & 21 deletions

File tree

.github/workflows/publish-docs.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 'Publish docs'
2+
on:
3+
push:
4+
branches: [main]
5+
6+
permissions:
7+
contents: read
8+
pages: write
9+
id-token: write
10+
11+
jobs:
12+
build_and_docs:
13+
name: 'Build and Docs'
14+
timeout-minutes: 5
15+
runs-on: ubuntu-latest
16+
environment:
17+
name: github-pages
18+
url: ${{ steps.deployment.outputs.page_url }}
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: latest
24+
- name: Setup Dependencies
25+
run: |
26+
corepack enable
27+
npm install
28+
- name: Build App and Typedoc
29+
run: |
30+
npm run build
31+
npm run typedoc
32+
- uses: actions/upload-pages-artifact@v3
33+
with:
34+
path: ./docs
35+
- name: Deploy Typedoc to GitHub Pages
36+
id: deployment
37+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,57 @@
11
name: 'Release'
2+
23
on:
3-
push:
4-
branches: [main]
4+
release:
5+
types: [created]
6+
workflow_dispatch:
57

68
permissions:
79
contents: read
8-
pages: write
910
id-token: write
1011

12+
concurrency:
13+
group: release
14+
cancel-in-progress: false
15+
1116
jobs:
12-
build_and_docs:
13-
name: 'Build and Docs'
14-
timeout-minutes: 5
17+
publish:
18+
name: 'Publish to npm'
19+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'release' && !github.event.release.draft)
20+
timeout-minutes: 10
1521
runs-on: ubuntu-latest
16-
environment:
17-
name: github-pages
18-
url: ${{ steps.deployment.outputs.page_url }}
22+
1923
steps:
2024
- uses: actions/checkout@v4
25+
2126
- uses: actions/setup-node@v4
2227
with:
23-
node-version: latest
28+
node-version: 22.13.1
29+
registry-url: 'https://registry.npmjs.org'
30+
2431
- name: Setup Dependencies
2532
run: |
2633
corepack enable
2734
npm install
28-
- name: Build App and Typedoc
35+
36+
- name: Read package version
37+
id: package
2938
run: |
30-
npm run build
31-
npm run typedoc
32-
- uses: actions/upload-pages-artifact@v3
33-
with:
34-
path: ./docs
35-
- name: Deploy Typedoc to GitHub Pages
36-
id: deployment
37-
uses: actions/deploy-pages@v4
39+
echo "version=$(node -p 'require(\"./package.json\").version')" >> "$GITHUB_OUTPUT"
40+
41+
- name: Validate release tag
42+
if: github.event_name == 'release'
43+
run: |
44+
expected_tag="v${{ steps.package.outputs.version }}"
45+
actual_tag="${{ github.event.release.tag_name }}"
46+
if [ "$actual_tag" != "$expected_tag" ]; then
47+
echo "Release tag $actual_tag does not match package version $expected_tag"
48+
exit 1
49+
fi
50+
51+
- name: Build package
52+
run: npm run build
53+
54+
- name: Publish package
55+
env:
56+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
57+
run: npm publish --access public --provenance

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sqlitecloud/drivers",
3-
"version": "1.0.837",
3+
"version": "1.0.875",
44
"description": "SQLiteCloud drivers for Typescript/Javascript in edge, web and node clients",
55
"main": "./lib/index.js",
66
"types": "./lib/index.d.ts",
@@ -12,7 +12,7 @@
1212
"build": "rm -rf ./lib/ && tsc --project tsconfig.build.json && npx webpack",
1313
"publish": "npm run build && npm publish --access public",
1414
"prettier": "prettier --write 'src/**/*'",
15-
"typedoc": "rm -rf ./docs/ && typedoc --out docs && typedoc --plugin typedoc-plugin-markdown --out docs/markdown",
15+
"typedoc": "rm -rf ./docs/ && typedoc --tsconfig tsconfig.build.json --out docs && typedoc --tsconfig tsconfig.build.json --plugin typedoc-plugin-markdown --out docs/markdown",
1616
"npmgui": "npx npm-gui@latest",
1717
"prepare": "husky"
1818
},

0 commit comments

Comments
 (0)