0%
测试
原文
Action自动化部署测试
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
| name: 自动部署
on: push: branches: - myblog
release: types: - published
jobs: checkout: runs-on: ubuntu-latest steps: - name: 检查分支 uses: actions/checkout@v2 with: ref: master
- name: 安装 Node uses: actions/setup-node@v1 with: node-version: "12.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 --save
- name: 生成静态文件 run: | hexo clean hexo generate
- name: 部署到github pages run: | git config --global user.name "ConstOwn" git config --global user.email "xxxxxx@foxmail.com" # git clone https://github.com/xxxxx/xxxx.github.io.git .deploy_git # 此处务必用HTTPS链接。SSH链接可能有权限报错的隐患 # =====注意.deploy_git前面有个空格===== # 这行指令的目的是clone博客静态文件仓库,防止Hexo推送时覆盖整个静态文件仓库,而是只推送有更改的文件 # 我注释掉了是为了刷新整个仓库,也可以选择不注释掉,但是可能出现没有识别到的情况 hexo deploy
|