Gmeek/CONIFG.md
2023-07-29 22:36:38 +08:00

2.8 KiB

配置文件说明

config.js 文件

里面的key值请不要修改,如没有其中的value值请填写""

{
    "title":"Meekdai",
    "subTitle":"童话是一种生活态度,仅此而已。",
    "homeUrl":"http://blog.meekdai.com",
    "avatarUrl":"http://meekdai.com/avatar.jpg",
    "faviconUrl":"http://meekdai.com/favicon.ico",
    "startSite":"02/16/2015",
    "filingNum":"浙ICP备20023628号",
    "singlePage":["link","about"],
    "commentLabelColor":"#006b75",
    "yearColorList":["#bc4c00", "#0969da", "#1f883d", "#A333D0"]
}

.github/workflows/Gmeek.yml 文件

注意修改其中的GITHUB_NAMEGITHUB_EMAIL两个参数。

name: build Gmeek

on:
  workflow_dispatch:
  issues:
    types: [opened, edited]

env:
  GITHUB_NAME: Meekdai
  GITHUB_EMAIL: meekdai@163.com

jobs:
  sync:
    name: Generate blog
    runs-on: ubuntu-20.04
    if: github.event.repository.owner.id == github.event.sender.id
    permissions:
      contents: write
      pages: write
      id-token: write
    concurrency:
      group: "pages"
      cancel-in-progress: false
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
      
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Set up Python
        uses: actions/setup-python@v1
        with:
          python-version: 3.8

      - name: Clone source code
        run: |
          git clone https://github.com/Meekdai/Gmeek.git /opt/Gmeek          

      - name: Install dependencies
        run: |
          pip install --upgrade pip
          pip install -r /opt/Gmeek/requirements.txt          

      - name: Generate new html
        run: |
          cp -r ./* /opt/Gmeek/
          cd /opt/Gmeek/
          echo "====== check config.josn file ======"
          cat config.json
          echo "====== check config.josn end  ======"
          python Gmeek.py ${{ secrets.meblog }} ${{ github.repository }} --issue_number '${{ github.event.issue.number }}'
          cp -a /opt/Gmeek/docs/. ${{ github.workspace }} 
          cp /opt/Gmeek/blogBase.json ${{ github.workspace }}           
        
      - name: update html
        run: |
          git config --local user.email "${{ env.GITHUB_EMAIL }}"
          git config --local user.name "${{ env.GITHUB_NAME }}"
          git add .
          git commit -a -m '🎉auto update by Gmeek action' || echo "nothing to commit"
          git push || echo "nothing to push"          
    
      - name: Checkout
        uses: actions/checkout@v3
      - name: Setup Pages
        uses: actions/configure-pages@v3
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v2
        with:
          # Upload entire repository
          path: '.'
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v2