git action

  • 个人设置(用户账号下面的settings) - Developer settings - Personal access tokens

  • 项目 - Settings - Secrets

  • 本地项目,创建 .github/workflows/ci.yml

  • 本地项目,package.json 中增加

    • "homepage": "https://[用户名].github.io/[仓库名称]",这里要写的是gitlhubpages的地址(项目settings - githubpages - check 查看地址)
  • 本地项目,创建 vue.config.js

module.exports = {
  outputDir: 'dist',
  publicPath: process.env.NODE_ENV === 'production' ? '/github的仓库名称/' : '/'
}
  • 提交-推送
  • 设置 Github Pages - 指定 gh-pages 分支

*.yml文件
https://github.com/marketplace/actions/deploy-to-github-pages?version=4.0.0

name: GitHub Actions Build and Deploy Demo
on:
  push:
    branches:
      - master
jobs:
  build-and-deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v2.3.1

      - name: Install and Build 🔧 # This example project is built using npm and outputs the result to the 'build' folder. Replace with the commands required to build your project, or remove this step entirely if your site is pre-built.
        run: |
          npm install
          npm run build

      - name: Deploy 🚀
        uses: JamesIves/github-pages-deploy-action@4.0.0
        with:
          branch: gh-pages # The branch the action should deploy to.
          folder: dist # The folder the action should deploy.

https://github.com/JamesIves/github-pages-deploy-action

posted @ 2021-05-09 14:08  巡匿精灵  阅读(236)  评论(0编辑  收藏  举报