Skip to content

Build and Deploy

Build and Deploy #306

Workflow file for this run

# https://www.ruanyifeng.com/blog/2016/07/yaml.html
# 手动触发
name: Build and Deploy
on:
push:
branches:
- master
# 定时任务在utc的9点执行,换算北京时间需要 + 8也就是凌晨五点
schedule:
- cron: "0 21 * * *"
jobs:
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node: ["lts/fermium"]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: "master"
persist-credentials: false
fetch-depth: 0
env:
TZ: Asia/Shanghai
- name: Use Node.js 12.18.3
uses: actions/setup-node@v3
with:
node-version: '12.18.3'
- name: npm Install
run: npm install
- name: Build Nuxt Pages
run: npm run generate
- name: Deploy to Pages
env:
TZ: Asia/Shanghai
run: |
cd dist
git init
git config user.name "yanyue404"
git config user.email "1656800216@qq.com"
git add .
git commit -m 'Deploying to gh-pages from Github actions'
git push -f https://ACCESS_TOKEN:${{secrets.ACCESS_TOKEN }}@github.com/yanyue404/blog.git master:gh-pages
cd -