enhance random script #180
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: Deploy Hexo | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Check Out | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # 用于获取提交记录,获取文件更新时间 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: "yarn" | |
- name: Install Dependencies | |
run: | | |
yarn install | |
# https://github.com/zhullyb/zhullyb.github.io/blob/master/.github/workflows/deploy.yml | |
# 修复 hexo 生成的文件更新时间 为当前时间,实际应为提交时间 | |
- name: Fix File Updated Date | |
run: | | |
git ls-files "*.md" | while read filepath; do touch -d "$(git log -1 --format='@%ct' $filepath)" "$filepath" && echo "Fixed: $filepath"; done | |
- name: Build Site | |
run: | | |
yarn build | |
- name: Move baidu_verify | |
run: | | |
cp asset/baidu_verify_codeva-GwRsL4VPtx.html.html public/ | |
cp asset/naver57322dd0ed14599dd3052c79c6892766.html public/ | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: public |