第一步、创建一个GitHub仓库
第二步、在vscode里写入
git remote add origin 仓库地址
git branch -M 仓库主分支
git push -u origin 仓库主分支
第三步、把代码先提交上去
第四步、
添加一个工作流程:
name: Vue Deploy
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.PAT }} # 此处修改为你的Secret名称
publish_dir: ./dist
最后在个人主页中配置一个密钥,把密钥配置到仓库中
注意!
记得把vue.config.js内添加一个
publicPath: '/仓库名/',
然后就可以正常打开vue项目了