Skip to content

Commit

Permalink
精简workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
AIboy996 committed Sep 20, 2024
1 parent b714874 commit 86fe1d3
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 86 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/static.yml

This file was deleted.

93 changes: 54 additions & 39 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
name: update

permissions:
contents: write
name: auto update

on:
schedule:
Expand All @@ -11,39 +8,57 @@ on:
- main
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false


jobs:
spider:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11.x"
- run: python3 -m pip install requests
- run: python3 main.py > LATEST
- name: Commit files
id: commit-files
run: |
if [ -n "$(git status --porcelain database.json)" ]; then
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "$(cat LATEST)"
echo "hasChange=true" >> $GITHUB_OUTPUT
else
echo "No changes detected"
fi
- name: Push changes
uses: ad-m/github-push-action@master
if: ${{ steps.commit-files.outputs.hasChange == 'true' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Trigger deploy
if: ${{ steps.commit-files.outputs.hasChange == 'true' }}
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.everest-preview+json" \
https://api.github.com/repos/owner/repo/dispatches \
-d '{"event_type": "run-deploy"}'
spider:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11.x"
- run: python3 -m pip install requests
- run: python3 main.py > LATEST
- name: Commit files
id: commit-files
run: |
if [ -n "$(git status --porcelain database.json)" ]; then
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "$(cat LATEST)"
echo "hasChange=true" >> $GITHUB_OUTPUT
else
echo "No changes detected"
fi
- name: Push changes
if: ${{ steps.commit-files.outputs.hasChange == 'true' }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Setup Pages
if: ${{ steps.commit-files.outputs.hasChange == 'true' }}
uses: actions/configure-pages@v5
- name: Upload artifact
if: ${{ steps.commit-files.outputs.hasChange == 'true' }}
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: '.'
- name: Deploy to GitHub Pages
if: ${{ steps.commit-files.outputs.hasChange == 'true' }}
id: deployment
uses: actions/deploy-pages@v4
5 changes: 0 additions & 5 deletions database.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@
"thumb_hash": "31f7f9a78cfec6710a62a6c1fc119edd",
"thumb_name": "Bilibili 10周年"
},
"0013": {
"thumb": "http://i0.hdslb.com/bfs/archive/3007728d674a385306ba0b07055103a78b9eed62.png",
"thumb_hash": "ad7bb6b7fd542862f093dedad32b7af3",
"thumb_name": "Bilibili 11周年"
},
"0014": {
"thumb": "http://i0.hdslb.com/bfs/archive/1d40e975b09d5c87b11b3ae0c9ce6c6b82f63d9e.png",
"thumb_hash": "de1877c33dfef853af867b01c4926d7f",
Expand Down
Binary file removed imgs/Bilibili 11周年.webp
Binary file not shown.

0 comments on commit 86fe1d3

Please sign in to comment.