Update copyright.ejs #133
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: blog-build | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'blog/**' | |
env: | |
GIT_USER: barretlee | |
GIT_EMAIL: barret.china@gmail.com | |
jobs: | |
build: | |
name: Build on node ${{ matrix.node_version }} and ${{ matrix.os }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node_version: [16.x] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: restore node_modules | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Use Node.js ${{ matrix.node_version }} | |
uses: actions/setup-node@v3.4.1 | |
with: | |
node-version: ${{ matrix.node_version }} | |
cache: 'npm' | |
- 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_ed25519 | |
chmod 600 ~/.ssh/id_ed25519 | |
ssh-keyscan github.com >> ~/.ssh/known_hosts | |
git config --global user.name $GIT_USER | |
git config --global user.email $GIT_EMAIL | |
# - name: Test connection | |
# run: | | |
# ssh -vvvT git@github.com | |
- name: Install dependencies | |
if: steps.restore.outputs.cache-hit != 'true' | |
run: npm install | |
working-directory: blog | |
- name: Deploy hexo | |
run: | | |
NODE_ENV=ci npm run deploy | |
working-directory: blog | |
# 插件问题,execSync 操作导致输出到 stdout 的内容太多,溢出报错 | |
# node -e "const fs = require('fs'); let content = fs.readFileSync('_config.yml').toString().replace(/image_minifier[\s\S]+?enable: false/gmi, 'image_minifier:\n enable: true'); fs.writeFileSync('_config.yml', content);" | |
- name: save node_modules | |
uses: actions/cache@v2 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} |