Skip to content

Notion2Hexo

Notion2Hexo #3941

Workflow file for this run

name: Notion2Hexo
on:
workflow_dispatch:
schedule:
- cron: '*/30 1-17/1 * * *'
permissions:
contents: write
jobs:
notionSyncTask:
name: Notion2hexo on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout blog and theme
uses: actions/checkout@v3
with:
submodules: 'recursive'
fetch-depth: 0
- name: Check the NOTION_SYNC_DATETIME
id: GetNotionSyncDatetime
run: |
NOTION_SYNC_DATETIME=$(git log -n 1 --grep="NotionSync" --format="%aI")
echo "NOTION_SYNC_DATETIME=$NOTION_SYNC_DATETIME" >> "$GITHUB_OUTPUT"
echo -e "Latest notion sync datetime:\n$NOTION_SYNC_DATETIME"
- name: Convert notion to markdown
id: NotionSync
uses: HereIsZephyrus/notion2markdown-action@latest
with:
notion_secret: ${{ secrets.NOTION_TOKEN }}
database_id: ${{ secrets.NOTION_DATABASE_ID }}
pic_migrate: false
pic_bed_config: ${{ secrets.PICBED_CONFIG }}
pic_compress: false
output_page_dir: 'source'
output_post_dir: 'source/_posts/notion'
clean_unpublished_post: true
metas_keeped: abbrlink
metas_excluded: pstatus,ptype
last_sync_datetime: ${{ steps.GetNotionSyncDatetime.outputs.NOTION_SYNC_DATETIME }}
- name: add pandoc support
run: |
wget https://github.com/jgm/pandoc/releases/download/2.10.1/pandoc-2.10.1-1-amd64.deb
sudo dpkg -i pandoc-2.10.1-1-amd64.deb
npm install hexo-renderer-pandoc --save # for mathjax
npm install
- name: Hexo deploy
if: steps.NotionSync.outputs.updated_count != '0'
run: |
git pull
npm install && npm run deploy
- name: Commit & Push
if: steps.NotionSync.outputs.updated_count != '0'
uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: 'source/'
commit_message: Automatic NotionSync.