From 0a1d0a8b948a804f0b720bb7be3ce595a169c43b Mon Sep 17 00:00:00 2001 From: Meekdai Date: Wed, 3 Apr 2024 17:41:06 +0800 Subject: [PATCH] :sweat_smile: --- Gmeek.py | 5 +--- Gmeek.yml | 89 ------------------------------------------------------- 2 files changed, 1 insertion(+), 93 deletions(-) delete mode 100644 Gmeek.yml diff --git a/Gmeek.py b/Gmeek.py index ce196ce..53f51d1 100644 --- a/Gmeek.py +++ b/Gmeek.py @@ -438,11 +438,9 @@ docListFile=open(blog.root_dir+"postList.json","w") docListFile.write(json.dumps(blog.blogBase["postListJson"])) docListFile.close() -workspace_path = os.environ.get('GITHUB_WORKSPACE') -shutil.copyfile('Gmeek.yml', workspace_path+'/.github/workflows/Gmeek.yml') - if os.environ.get('GITHUB_EVENT_NAME')!='schedule': print("====== update readme file ======") + workspace_path = os.environ.get('GITHUB_WORKSPACE') readme="# %s :link: %s \r\n" % (blog.blogBase["title"],blog.blogBase["homeUrl"]) readme=readme+"### :page_facing_up: [%d](%s/tag.html) \r\n" % (len(blog.blogBase["postListJson"]),blog.blogBase["homeUrl"]) readme=readme+"### :speech_balloon: %d \r\n" % commentNumSum @@ -452,5 +450,4 @@ if os.environ.get('GITHUB_EVENT_NAME')!='schedule': readmeFile=open(workspace_path+"/README.md","w") readmeFile.write(readme) readmeFile.close() - ###################################################################################### diff --git a/Gmeek.yml b/Gmeek.yml deleted file mode 100644 index bb9ba1c..0000000 --- a/Gmeek.yml +++ /dev/null @@ -1,89 +0,0 @@ -name: build Gmeek - -on: - workflow_dispatch: - issues: - types: [opened, edited] - schedule: - - cron: "0 16 * * *" - -jobs: - build: - name: Generate blog - runs-on: ubuntu-20.04 - if: ${{ github.event.repository.owner.id == github.event.sender.id || github.event_name == 'schedule' }} - permissions: write-all - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Pages - id: pages - uses: actions/configure-pages@v4 - - - name: Get config.json - run: | - echo "====== check config.josn file ======" - cat config.json - echo "====== check config.josn end ======" - sudo apt-get install jq - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: 3.8 - - - name: Clone source code - run: | - GMEEK_VERSION=$(jq -r ".GMEEK_VERSION" config.json) - git clone https://github.com/Meekdai/Gmeek.git /opt/Gmeek; - cd /opt/Gmeek/ - lastTag=$(git describe --tags `git rev-list --tags --max-count=1`) - if [ $GMEEK_VERSION == 'last' ]; then git checkout $lastTag; else git checkout $GMEEK_VERSION; fi; - - - 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/ - python Gmeek.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} --issue_number '${{ github.event.issue.number }}' - cp -a /opt/Gmeek/docs ${{ github.workspace }} - cp -a /opt/Gmeek/backup ${{ github.workspace }} - cp /opt/Gmeek/blogBase.json ${{ github.workspace }} - - - name: update html - run: | - git config --local user.email "$(jq -r ".email" config.json)" - git config --local user.name "${{ github.repository_owner }}" - git add . - git commit -a -m '🎉auto update by Gmeek action' || echo "nothing to commit" - git push || echo "nothing to push" - sleep 3 - - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: 'docs/.' - - deploy: - name: Deploy blog - runs-on: ubuntu-20.04 - needs: build - 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: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 \ No newline at end of file