流程文件(适用于suka主题)
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
| name: 自动部署 # 当有改动推送到master分支时,启动Action on: push: branches: - main #2020年10月后github新建仓库默认分支改为main,注意更改 release: types: - published
jobs: deploy: runs-on: ubuntu-latest steps: - name: 检查分支 uses: actions/checkout@v2 with: ref: main
- name: 安装 Node uses: actions/setup-node@v1 with: node-version: '16.x'
- name: 安装 Hexo run: | export TZ='Asia/Shanghai' npm install hexo-cli -g
- name: 缓存 Hexo uses: actions/cache@v1 id: cache with: path: node_modules key: ${{runner.OS}}-${{hashFiles('**/package-lock.json')}}
- name: 安装依赖 if: steps.cache.outputs.cache-hit != 'true' run: | npm install gulp npm install gulp-cli -g #全局安装gulp npm install --save - name: 缓存 Suka uses: actions/cache@v1 id: suka with: path: themes/suka/node_modules key: ${{runner.OS}}-${{hashFiles('**/themes/suka/package-lock.json')}} - name: 安装依赖suka if: steps.suka.outputs.cache-hit != 'true' run: | cd themes/suka npm i --production - name: 连接密钥 run: | mkdir -p ~/.ssh echo "$SSH_DEPLOY_KEY" | tr -d '\r' > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keyscan -H 'github.com' >> ~/.ssh/known_hosts env: SSH_DEPLOY_KEY: ${{ secrets.HEXO_DEPLOY_PRI }}
- name: Prepare git env run: | git config --global user.email 1833505972@qq.com git config --global user.name huntersxy - name: Deploy Blog run: | hexo generate -d -f
|
本文作者 : Huntersxy
本文使用 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 协议
本文链接 : https://blog.xiey.work/2022/10/03/blog-ci/
本文最后更新于 天前,文中所描述的信息可能已发生改变