mirror of
https://github.com/jackyzha0/quartz.git
synced 2026-07-22 03:00:29 +00:00
78 lines
2 KiB
YAML
78 lines
2 KiB
YAML
name: Deploy to GitHub Pages
|
|
|
|
on:
|
|
# Запускается при пуше в main
|
|
push:
|
|
branches: [main]
|
|
# Ручной запуск
|
|
workflow_dispatch:
|
|
# Автоматическая синхронизация каждые 6 часов
|
|
schedule:
|
|
- cron: "0 */6 * * *"
|
|
|
|
# Разрешения для GitHub Pages
|
|
permissions:
|
|
contents: write
|
|
pages: write
|
|
id-token: write
|
|
|
|
# Одновременно только один деплой
|
|
concurrency:
|
|
group: "pages"
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
deploy:
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
cache: "npm"
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Sync Obsidian Notes
|
|
env:
|
|
OBSIDIAN_VAULT_TOKEN: ${{ secrets.OBSIDIAN_VAULT_TOKEN }}
|
|
run: bash scripts/sync-obsidian-notes.sh
|
|
|
|
- name: Commit synced notes
|
|
run: |
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git add content/obsidian-notes/
|
|
if ! git diff --cached --quiet; then
|
|
git commit -m "sync: update obsidian notes [skip ci]"
|
|
git push
|
|
else
|
|
echo "No changes to commit"
|
|
fi
|
|
|
|
- name: Install Quartz plugins
|
|
run: npx tsx ./quartz/plugins/loader/install-plugins.ts
|
|
env:
|
|
NODE_OPTIONS: "--no-warnings --experimental-require-module"
|
|
|
|
- name: Build Quartz
|
|
run: npx quartz build
|
|
|
|
- name: Setup Pages
|
|
uses: actions/configure-pages@v5
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: public
|
|
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|