git-page

GitPage

git page

ppRbAbT.png

ppRbuG9.png

ppRblKx.png

  • 添加token

ppRHbvt.png

  • 仓库->设置->Action

设置action,可读写可运行.yml,否则会出现推送失败

ppRb5LV.png

ppRbTdU.png

  • 仓库->设置->pages运行分支

ppRHxUg.md.png

  • 设置显示链接(前提个人.github.io)公开

ppRbqJJ.png

git action

git page

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
name: remake to kyj
on:
#监听push操作
push:
branches:
- master # 这里只配置了main分支,所以只有推送main分支才会触发以下任务
jobs:
# 任务ID
build-and-deploy:
# 运行环境
runs-on: ubuntu-latest
# 步骤
steps:
# 官方action,将代码拉取到虚拟机
- name: Checkout
uses: actions/checkout@v3

- name: Install and Build # 安装依赖、打包,如果提前已打包好无需这一步
run: |
npm install
npm run build

- name: Deploy # 部署
uses: JamesIves/github-pages-deploy-action@v4.3.3
with:
branch: pages # 部署后提交到那个分支
folder: dist # 这里填打包好的目录名称

推送云端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: deploy to tencent
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
# 切换分支
- name: Checkout
uses: actions/checkout@master
# - name: work around permission issue
# run: git config --global --add safe.directory /github/workspace
# 使用 node:16.18.0
- name: use Node.js 16.18.0
uses: actions/setup-node@v1
with:
node-version: 16.18.0
# npm install
- name: npm install and build
run: |
npm install
npm run build
# env:
# CI: true
# Deploy
# - name: Deploy tencent
# uses: cross-the-world/scp-pipeline@master
# env:
# SSH_PRIVATE_KEY: ${{ secrets.SECRETS }}
# REMOTE_HOST: ${{ secrets.HOST }}
# REMOTE_USER: ${{ secrets.USER }}
# SOURCE: '<资源路径>'
# TARGET: '<目标文件路径>'
# connect_timeout: 10s
# ARGS: '-avz --delete'

参考内容:


git-page
https://github.com/WestCraneLi/WestCraneLi.github.io/2023/04/01/git-page/
作者
WestCraneLi
发布于
2023年4月1日
许可协议