mirror of https://github.com/Nofated095/blog
Create main.yml
This commit is contained in:
parent
90dfb6cf5d
commit
c4bdf6a143
|
@ -0,0 +1,59 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
env:
|
||||
GIT_USER: Nofated095
|
||||
GIT_EMAIL: nofated095@outlook.com
|
||||
THEME_BRANCH: master
|
||||
DEPLOY_REPO: Nofated095/nofated095.github.io
|
||||
DEPLOY_BRANCH: master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build on node ${{ matrix.node_version }} and ${{ matrix.os }}
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
node_version: [12.x]
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Checkout deploy repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: ${{ env.DEPLOY_REPO }}
|
||||
ref: ${{ env.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 github.com >> ~/.ssh/known_hosts
|
||||
git config --global user.name $GIT_USER
|
||||
git config --global user.email $GIT_EMAIL
|
||||
cp _config.theme.yml themes/concise/_config.yml
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm install
|
||||
|
||||
- name: Deploy hexo
|
||||
run: |
|
||||
npm run deploy
|
Loading…
Reference in New Issue