Skip to content

fix: 改用 git clone 替代 actions/checkout 来获取 EGO(支持绝对路径) #53

fix: 改用 git clone 替代 actions/checkout 来获取 EGO(支持绝对路径)

fix: 改用 git clone 替代 actions/checkout 来获取 EGO(支持绝对路径) #53

Workflow file for this run

name: 提交 habitica 任务 + 构建博客

Check failure on line 1 in .github/workflows/github-action.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/github-action.yml

Invalid workflow file

(Line: 31, Col: 16): Unrecognized named-value: 'runner'. Located at position 1 within expression: runner.temp, (Line: 33, Col: 18): Unrecognized named-value: 'runner'. Located at position 1 within expression: runner.temp
on:
push:
branches: [source]
permissions:
contents: write
jobs:
Finish-Habitica-Tasks:
runs-on: ubuntu-latest
steps:
- name: Check out habash code
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: nasfarley88/habash
- name: 确保 habash 可执行
run: chmod +x ./habash
- name: 提交 habitica 任务
run: |
set -x
./habash up "写博客"
env:
HABITICA_TOKEN: ${{ secrets.HABITICA_TOKEN }}
HABITICA_UUID: ${{ secrets.HABITICA_UUID }}
Build-Blog:
runs-on: ubuntu-latest
env:
EGO_DIR: ${{ runner.temp }}/EGO
REPO_DIR: ${{ github.workspace }}
STORE_DIR: ${{ runner.temp }}/web
REPO: https://github.com/lujun9972/${{ github.event.repository.name }}
steps:
- name: Checkout 博客源文件
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: source
- name: Checkout EGO
run: git clone https://github.com/lujun9972/EGO.git "$EGO_DIR"
- name: Checkout master 分支到 store-dir
run: |
git clone --branch master --single-branch \
https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git \
"$STORE_DIR"
cd "$STORE_DIR"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: 安装 Emacs 和系统依赖
run: sudo apt-get update && sudo apt-get install -y emacs-nox
- name: 执行 auto_publish.el 构建博客
run: emacs --batch -l auto_publish.el
- name: 推送 HTML 到 master 分支
run: |
cd "$STORE_DIR"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git diff --staged --quiet || git commit -m "auto publish: $(date -u +%Y-%m-%dT%H:%M:%SZ)"
git push origin master