@@ -2,19 +2,22 @@ name: Deploy Docs
22
33on :
44 push :
5- branches :
6- - main
7- - next
8- - " v*"
5+ branches : [main]
96 paths :
107 - ' docs/**'
118 - ' .github/workflows/docs.yml'
129
1310permissions :
14- contents : write
11+ contents : read
12+ pages : write
13+ id-token : write
14+
15+ concurrency :
16+ group : " pages"
17+ cancel-in-progress : false
1518
1619jobs :
17- build-and-deploy :
20+ build :
1821 runs-on : ubuntu-latest
1922 steps :
2023 - name : Checkout
@@ -35,34 +38,23 @@ jobs:
3538 - name : Install dependencies
3639 run : pnpm install --frozen-lockfile
3740
38- - name : Determine Base Path
39- id : vars
40- run : |
41- BRANCH=${GITHUB_REF#refs/heads/}
42- if [ "$BRANCH" = "main" ]; then
43- echo "BASE=/express-cli/" >> $GITHUB_OUTPUT
44- echo "FOLDER=." >> $GITHUB_OUTPUT
45- elif [ "$BRANCH" = "next" ]; then
46- echo "BASE=/express-cli/next/" >> $GITHUB_OUTPUT
47- echo "FOLDER=next" >> $GITHUB_OUTPUT
48- elif [[ $BRANCH == v* ]]; then
49- # Extract major version, e.g., v1 from v1.x
50- VERSION=$(echo $BRANCH | cut -d'.' -f1)
51- echo "BASE=/express-cli/$VERSION/" >> $GITHUB_OUTPUT
52- echo "FOLDER=$VERSION" >> $GITHUB_OUTPUT
53- fi
54-
5541 - name : Build with VitePress
56- run : |
57- pnpm run docs:build
58- touch docs/.vitepress/dist/.nojekyll
42+ run : pnpm run docs:build
5943 env :
60- VITEPRESS_BASE : ${{ steps.vars.outputs.BASE }}
44+ VITEPRESS_BASE : /express-cli/
6145
62- - name : Deploy to GitHub Pages
63- uses : peaceiris/ actions-gh- pages@v4
46+ - name : Upload artifact
47+ uses : actions/upload- pages-artifact@v3
6448 with :
65- github_token : ${{ secrets.GITHUB_TOKEN }}
66- publish_dir : docs/.vitepress/dist
67- destination_dir : ${{ steps.vars.outputs.FOLDER }}
68- keep_files : true # CRITICAL: This keeps other versions alive!
49+ path : docs/.vitepress/dist
50+
51+ deploy :
52+ environment :
53+ name : github-pages
54+ url : ${{ steps.deployment.outputs.page_url }}
55+ needs : build
56+ runs-on : ubuntu-latest
57+ steps :
58+ - name : Deploy to GitHub Pages
59+ id : deployment
60+ uses : actions/deploy-pages@v4
0 commit comments