-
Notifications
You must be signed in to change notification settings - Fork 58
110 lines (97 loc) · 3.43 KB
/
deloy.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# https://docs.github.com/zh/actions
name: blog deploy
on:
workflow_dispatch: # 启用手动触发工作流
push:
branches:
- master
pull_request:
permissions: # 操作权限
contents: read
pull-requests: read
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- name: Encoding
run: |
# git config --global i18n.logoutputencoding utf-8
# git config --global i18n.commitencoding utf-8
# git config --global core.quotepath false
# git config --global http.version HTTP/1.1
# git config --global http.postBuffer 524288000
git config --global user.email "[email protected]"
git config --global user.name "bajins"
# export LESSCHARSET=utf-8
- name: Checkout
uses: actions/checkout@v3
with:
# Whether to checkout submodules: `true` to checkout submodules or `recursive` to
# recursively checkout submodules.
#
# When the `ssh-key` input is not provided, SSH URLs beginning with
# `[email protected]:` are converted to HTTPS.
#
# Default: false
submodules: 'true'
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '12.x'
# - run: npm ci
- run: npm install
- run: npm run build
# https://github.com/peaceiris/actions-gh-pages
- name: Deploy
uses: peaceiris/[email protected]
with: # 为预定义变量赋值
# DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PERSONAL_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
EXTERNAL_REPOSITORY: bajins/bajins.github.io
PUBLISH_BRANCH: master
PUBLISH_DIR: ./docs
FORCE_ORPHAN: true
USER_NAME: bajins
USER_EMAIL: [email protected]
# env: # 设置环境变量并赋值
sync-repository: # 同步文件到其他库
runs-on: ubuntu-latest
steps:
- name: Global
run: |
git config --global user.email "[email protected]"
git config --global user.name "bajins"
- name: Checkout
uses: actions/checkout@v3
with:
# /home/runner/work/notes-vuepress/notes-vuepress
path: ''
- name: Checkout notes-docsify repo
uses: actions/checkout@v3
with:
repository: bajins/notes-docsify
# /home/runner/work/notes-vuepress/notes-vuepress/notes-docsify
path: notes-docsify
token: ${{ secrets.PERSONAL_TOKEN }}
- name: Sync
run: |
cd notes-docsify
find . -maxdepth 1 -printf '%P\n' \
| grep -Ev ".git.*|.nojekyll|CNAME|README.*|index.*|push.*|wercker.*" \
| xargs rm -rf
cd ../
ls -lh
cp -r `ls -A | grep -Ev \
".git|.github|.vuepress|.gitattributes|.gitignore|.gitmodules|package.json|README.md|notes-docsify"`\
notes-docsify
cp -r .vuepress/public/images .vuepress/public/files notes-docsify
# echo "-------------------------------------------------------------"
# find $GITHUB_WORKSPACE
# echo "-------------------------------------------------------------"
cd notes-docsify
echo -e '#!/bin/bash\n\n./push.sh'>.git/hooks/pre-commit
chmod +x ./push.sh
chmod +x .git/hooks/pre-commit
git add -A
git commit -m "sync"
git push