Add SecGPT1.md #50
This file contains hidden or 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: Hexo | |
# 触发条件:在 push 到 hexo 分支后触发 | |
on: | |
push: | |
branches: | |
- hexo | |
env: | |
TZ: Asia/Shanghai | |
jobs: | |
blog-cicd: | |
name: Hexo blog build & deploy | |
runs-on: ubuntu-latest # 使用最新的 Ubuntu 系统作为编译部署的环境 | |
steps: | |
- name: Checkout codes | |
uses: actions/checkout@v3 | |
- name: Setup node | |
# 设置 node.js 环境 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
- name: Cache node modules | |
# 设置包缓存目录,避免每次下载 | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
- name: Install hexo dependencies | |
# 下载 hexo-cli 脚手架及相关安装包 | |
run: | | |
npm install -g hexo-cli | |
npm install hexo-blog-encrypt | |
npm install | |
- name: Generate files | |
# 编译 markdown 文件 | |
run: | | |
hexo clean | |
hexo generate | |
- name: Deploy hexo blog | |
env: | |
# Github 仓库 | |
GITHUB_REPO: github.com/Coldwave96/Coldwave96.github.io | |
# 将编译后的博客文件推送到指定仓库 | |
run: | | |
cd ./public && git init && git add . | |
git config user.name "coldwave96" | |
git config user.email "676803965@qq.com" | |
echo "blog.coldsnap.myfw.us" > CNAME | |
echo "# Hexo" > README.md | |
echo "Personal Blog" >> README.md | |
git add . | |
git commit -m "GitHub Actions Auto Builder at $(date +'%Y-%m-%d %H:%M:%S')" | |
git push --force --quiet "https://${{ secrets.ACCESS_TOKEN }}@$GITHUB_REPO" master:master |