-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (59 loc) · 1.82 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
name: Site workflow
on:
push:
branches:
- master
jobs:
CI:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [20]
steps:
- name: Checkout
uses: actions/checkout@master
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
- name: Cache node_modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/pnpm.lock')) }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pnpm install
- name: Set up environment
env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
run: |
sudo timedatectl set-timezone "Asia/Shanghai"
mkdir -p ~/.ssh
echo "$DEPLOY_KEY" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com >> ~/.ssh/known_hosts
- name: Generate Site
run: pnpm build
- name: Deploy to GitHub Pages
run: |
cd ./dist
git init
git config user.name slivermoe
git config user.email [email protected]
git add .
current_time=`date '+%Y-%m-%d %H:%m:%S'`
git remote add origin [email protected]:s-complex/s-complex.github.io.git
git branch -M gh-pages
git commit -m "Updated at $current_time"
git push -u origin gh-pages --force