Skip to content

chore:ga2

chore:ga2 #8

Workflow file for this run

name: Github Actions For Hexo Auto Deploy
on:
push:
branches:
- dev
workflow_dispatch:
env:
GIT_USER: shenliyang
GIT_EMAIL: [email protected]
GIT_DEPLOY_REPO: shenliyang/shenliyang.github.io
GIT_DEPLOY_BRANCH: master
GITEE_USER: shenliyang
GITEE_DEPLOY_REPO: shenliyang/shenliyang
GITEE_DEPLOY_BRANCH: master
GIT_SOURCE_REPO: [email protected]:shenliyang/shenliyang.github.io.git
GITEE_DESTINATION_REPO: [email protected]:shenliyang/shenliyang.git
jobs:
build:
name: Build on node ${{ matrix.node_version }} and ${{ matrix.os }}
runs-on: ubuntu-latest
if: github.event.repository.owner.id == github.event.sender.id
strategy:
matrix:
os: [ubuntu-18.04]
node_version: [14.x]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout deploy repo
uses: actions/checkout@v2
with:
repository: ${{ env.GIT_DEPLOY_REPO }}
ref: ${{ env.GIT_DEPLOY_BRANCH }}
path: .deploy_git
- 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: |
sudo timedatectl set-timezone "Asia/Shanghai"
mkdir -p ~/.ssh/
echo "$HEXO_DEPLOY_PRI" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
# ssh-keyscan -t rsa gitee.com >> ~/.ssh/known_hosts
git config --global user.name $GIT_USER
git config --global user.email $GIT_EMAIL
- name: Install dependencies
run: |
npm install hexo-cli gulp-cli hexo-deployer-git -g
npm install
hexo clean && hexo g
gulp
- name: Deploy hexo
run: |
npm run deploy