-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
54 additions
and
37 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Deploy to GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # 当推送到 main 分支时触发 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "16" # 你可以根据项目需要调整 Node.js 版本 | ||
|
||
- name: Install dependencies | ||
run: yarn install # 如果使用的是其他包管理工具,调整命令 | ||
|
||
- name: Build the project | ||
run: npm run build # 构建项目,确保构建输出到指定目录(如 ./build 或 ./dist) | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 # 用于推送到 gh-pages 分支 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} # 内置 GitHub Token,用于授权操作 | ||
publish_branch: gh-pages # 部署的分支 | ||
publish_dir: ./build # 构建后的输出目录,根据项目调整(如 ./dist) |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env sh | ||
|
||
# 确保脚本抛出遇到的错误 | ||
set -e | ||
|
||
# 生成静态文件 | ||
npm run build | ||
|
||
# 进入生成的文件夹 | ||
cd dist | ||
|
||
git init | ||
git add -A | ||
git commit -m 'deploy' | ||
|
||
# 如果发布到 https://<USERNAME>.github.io | ||
git push -f git@github.com:cp3hnu/Sudoku.git main:gh-pages | ||
|
||
cd - |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
const { defineConfig } = require("@vue/cli-service"); | ||
module.exports = defineConfig({ | ||
transpileDependencies: true, | ||
publicPath: process.env.NODE_ENV === "production" ? "/Sudoku/" : "/", | ||
}); |