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
| on: push jobs: build: runs-on: macOS-latest
steps: - uses: actions/checkout@v1 - name: Use Node.js 10.x uses: actions/setup-node@v1 with: node-version: "10.x"
- name: Setup Hexo env env: ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }} run: | # set up private key for deploy mkdir -p ~/.ssh/ echo "$ACTIONS_DEPLOY_KEY" > ~/.ssh/id_rsa chmod 600 ~/.ssh/id_rsa ssh-keyscan github.com >> ~/.ssh/known_hosts # set git infomation git config --global user.name 'yourname' git config --global user.email 'yourname@gmail.com'
# install dependencies export TZ='Asia/Shanghai' npm i -g hexo-cli npm i npm install hexo-deployer-git --save npm install hexo-generator-search-zip --save - name: Deploy run: | hexo generate # 解决 commit 清空问题 git clone https://github.com/yourname/yourname.github.io .deploy_git cd .deploy_git git checkout master cd ../ # generate and depoly hexo deploy
|