-
Notifications
You must be signed in to change notification settings - Fork 2
75 lines (59 loc) · 2.22 KB
/
main.yml
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: main
on:
push:
branches:
- master
jobs:
build-deploy:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- run: yarn # 相当于npm install
- run: yarn deploy
#发布到huang-1234.github.io/master
- name: GitHub Pages action
uses: peaceiris/actions-gh-pages@v3.9.3
env:
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
EXTERNAL_REPOSITORY: huang-1234/huang-1234.github.io #可以新建一个huang-1234.github.io仓库发布到master
PUBLISH_BRANCH: master
PUBLISH_DIR: dist
with:
node-version: 16
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
command_timeout: 50m
script:
set -e
# 生成静态文件
yarn run build
# git init
git add .
git commit -m 'update lang'
# git remote -v
# git pull
git push -f origin master
# 进入生成的文件夹
cd docs/.vuepress/dist
# 如果是发布到自定义域名
# echo 'www.example.com' > CNAME
git init
git add .
git commit -m 'update lang'
# 如果发布到 https://<USERNAME>.github.io
# git pull
git remote add origin git@github.com:huang-1234/huang-1234.github.io.git
# git remote -v
# git pull
# git push origin master
git push -f origin master
# #发布到MyBlog/gh-pages 查看https://mybells.github.io/MyBlog/,需要修改base配置为MyBlog,修改图片路径
# - name: Deploy MyBlog/gh-pages
# uses: peaceiris/actions-gh-pages@v2
# env:
# ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
# PUBLISH_BRANCH: gh-pages #也可以在本项目MyBlog新建gh-pages分支,名字一定要是gh-pages这样github page设置才能识别到这个分支,其他名字识别不到。https://help.github.com/cn/github/working-with-github-pages/creating-a-github-pages-site#creating-your-site
# PUBLISH_DIR: docs/.vuepress/dist
# with:
# emptyCommits: false