Featured image of post Audo Depoly by Github Action

Audo Depoly by Github Action

GitHub Action 自動部署 Hexo

自動部屬部落格

參考網址:https://op30132.github.io/2020/02/05/github-action/ 生成公私鑰時不用在部落格根目錄,記的不要加入 git,要刪掉

 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
name: HEXO CI

on:
    push:
        branches:
            - master

jobs:
    build:
        runs-on: ubuntu-latest
        strategy:
            matrix:
                node-version: [12.x]

        steps:
            - uses: actions/checkout@v1

            - name: Use Node.js ${{ matrix.node-version }}
              uses: actions/setup-node@v1
              with:
                  node-version: ${{ matrix.node-version }}

            - name: Configuration environment
              env:
                  HEXO_DEPLOY_PRI: ${{secrets.HEXO_DEPLOY_PRI}}
              run: |
                  mkdir -p ~/.ssh/
                  echo "$HEXO_DEPLOY_PRI" | tr -d '\r' > ~/.ssh/id_rsa
                  chmod 600 ~/.ssh/id_rsa
                  ssh-keyscan github.com >> ~/.ssh/known_hosts
                  git config --global user.name "simbafs"
                  git config --global user.email "simbafsgmail.com"                  
            - name: Install dependencies
              run: |
                  npm i -g hexo-cli
                  npm i -S hexo 
                  npm i                  
            - name: hexo
              run: |
                  git checkout hexo                  
            - name: config
              run: |
                  hexo config                  
            - name: test hexo
              run: |
                  hexo new post telsst                  
            - name: list
              run: |
                  ls source/_posts
                  PWD=$(pwd) hexo list post                  
            - name: clean
              run: |
                  hexo clean                  
            - name: generate
              run: |
                  hexo g                  
            - name: deploy
              run: |
                  hexo d                  
好想養貓阿~~
使用 Hugo 建立
主題 StackJimmy 設計