Skip to content

Commit f324445

Browse files
authored
Stop using doc branch to use github pages (#868)
`gh-pages` branch for documentation is no longer necessary. By using GitHub Actions, you can utilize GitHub Pages directly. This change supports that. Additionally, this change has made sure not to update the documentation until the upload to npm is complete. This is to prevent confusion among users if the documentation is updated but package is not updated. TODO: Modify settings in https://github.com/line/line-bot-sdk-nodejs/settings/pages after this change is merged ref: https://vitepress.dev/guide/deploy#github-pages Resolve #521
1 parent 329356c commit f324445

File tree

2 files changed

+52
-34
lines changed

2 files changed

+52
-34
lines changed

.github/workflows/deploy-doc.yml

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Deploy static content to Pages on release
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
concurrency:
13+
group: pages
14+
cancel-in-progress: false
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 18
24+
25+
- name: Setup Pages
26+
uses: actions/configure-pages@v4
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Build API Docs
31+
run: export NODE_OPTIONS=--openssl-legacy-provider; npm run apidocs
32+
- name: Build Docs
33+
run: export NODE_OPTIONS=--openssl-legacy-provider; npm run docs:build
34+
35+
- name: Upload artifact
36+
uses: actions/upload-pages-artifact@v3
37+
with:
38+
path: docs/.vitepress/dist
39+
40+
deploy:
41+
environment:
42+
name: github-pages
43+
url: ${{ steps.deployment.outputs.page_url }}
44+
needs: [build]
45+
runs-on: ubuntu-latest
46+
name: Deploy
47+
steps:
48+
- name: Deploy to GitHub Pages
49+
id: deployment
50+
uses: actions/deploy-pages@v4

.github/workflows/release.yml

+2-34
Original file line numberDiff line numberDiff line change
@@ -26,37 +26,5 @@ jobs:
2626
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2727

2828
deploy-docs:
29-
runs-on: ubuntu-latest
30-
steps:
31-
- uses: actions/checkout@v4
32-
- name: Use Node.js 18
33-
uses: actions/setup-node@v4
34-
with:
35-
node-version: 18
36-
- name: Install Dependency
37-
run: npm ci
38-
- name: Config Internal Git
39-
run: |
40-
git config --global user.email "[email protected]"
41-
git config --global user.name "GitHub Action"
42-
- name: Clone Doc History
43-
uses: actions/checkout@v4
44-
with:
45-
ref: 'gh-pages'
46-
path: 'doc-dist'
47-
- name: Clean Doc Directory
48-
run: |
49-
cd doc-dist
50-
ls | grep -v '.git' | xargs rm -r
51-
cd ../
52-
- name: Build API Docs
53-
run: export NODE_OPTIONS=--openssl-legacy-provider; npm run apidocs
54-
- name: Build Docs
55-
run: export NODE_OPTIONS=--openssl-legacy-provider; npm run docs:build
56-
- name: Copy & Deploy
57-
run: |
58-
cp -r docs/.vitepress/dist/* doc-dist/
59-
cd doc-dist
60-
git add -A
61-
git commit -m 'Deploy docs'
62-
git push
29+
needs: [release-package]
30+
use: ./.github/workflows/deploy-doc.yml

0 commit comments

Comments
 (0)