update #48
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Github Actions Deploy | |
on: | |
push: | |
branches: | |
- hexo # 只在 hexo 上 push 触发部署 | |
paths-ignore: # 下列文件的变更不触发部署,可以自行添加 | |
- README.md | |
- LICENSE | |
env: | |
GIT_USER: popring | |
GIT_EMAIL: koler778@gmail.com | |
THEME_REPO: theme-next/hexo-theme-next | |
THEME_BRANCH: master | |
DEPLOY_REPO: popring/popring.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: | |
- uses: actions/checkout@v2 | |
name: Use Node.js lts | |
- 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: | | |
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 | |
- name: Install dependencies | |
run: | | |
npm install | |
- name: Deploy hexo | |
run: | | |
npm run deploy |