Skip to content

Commit

Permalink
Setup github pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
gudaoxuri committed Sep 25, 2023
1 parent f571c3b commit b739f30
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
51 changes: 32 additions & 19 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ on:
branches:
- main

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
name: Build
Expand All @@ -16,6 +25,9 @@ jobs:

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm

- name: Install dependencies
uses: bahmutov/npm-install@v1
Expand All @@ -39,34 +51,35 @@ jobs:

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Install dependencies
uses: bahmutov/npm-install@v1
run: npm ci

- name: Build project
run: npm run docs:build
- name: Build with VitePress
run: |
npm run docs:build
touch docs/.vitepress/dist/.nojekyll
- name: Upload production-ready build files
uses: actions/upload-artifact@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
name: production-files
path: ./docs/.vitepress/dist
path: docs/.vitepress/dist

doc-deploy:
name: DocDeploy
needs: doc-build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: doc-build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: production-files
path: ./docs/.vitepress/dist

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/.vitepress/dist
id: deployment
uses: actions/deploy-pages@v2
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ node_modules
dist
dist-ssr
*.local
docs/.vuepress/.cache
docs/.vuepress/cache
docs/.vuepress/.temp
types
.idea
Expand Down

0 comments on commit b739f30

Please sign in to comment.