-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (52 loc) · 1.53 KB
/
deploy.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
name: Deploy Hexo to GitHub Pages
on:
push:
branches:
- gh-pages
env:
GIT_USER: fengjiansu
GIT_EMAIL: [email protected]
DEPLOY_REPO: fengjiansu/fengjiansu.github.io
DEPLOY_BRANCH: gh-pages
jobs:
build:
name: Build on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
node_version: [16.x]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout deploy repo
uses: actions/checkout@v4
with:
repository: ${{ env.DEPLOY_REPO }}
ref: ${{ env.DEPLOY_BRANCH }}
path: .deploy_git
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
- name: Configuration environment
env:
HEXO_DEPLOY_PRI: ${{secrets.HEXO_DEPLOY_PRI}}
run: |
sudo timedatectl set-timezone "Asia/Shanghai"
mkdir -p ~/.ssh
echo "$HEXO_DEPLOY_PRI" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
git config --global user.name $GIT_USER
git config --global user.email $GIT_EMAIL
- name: Update npm
run: npm install -g npm
- name: Install dependencies
run: |
npm config set registry https://registry.npmjs.org/
npm cache clean --force
npm install
- name: Deploy hexo
run: |
npm run deploy