add url base #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Vue 3 App to GitHub Pages | |
on: | |
# 触发条件:监听 main 分支的推送 | |
push: | |
branches: | |
- main | |
# 也可以手动触发 | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' # 使用 Node.js 的 LTS 版本 | |
- name: Install dependencies | |
run: npm install # 或者使用 pnpm install 或 yarn install | |
- name: Build Vue 3 project | |
run: npm run build # 或者使用 pnpm build 或 yarn build | |
- name: Verify build output | |
run: test -d ./dist # 确保构建目录存在 | |
- name: Setup GitHub Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./dist # 假设构建后的文件在 dist 文件夹中 | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |