调整搜索实现,添加自动生成search.xml和sitemap.xml的action

This commit is contained in:
Arronlong 2021-04-06 11:04:06 +08:00
parent 4a88b486c9
commit 03ab715aa5
2 changed files with 908 additions and 753 deletions

51
.github/workflows/actions-cfblog.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: 'CFBlog'
on:
watch:
types: started
schedule:
# 时间是按UTC设置的实际执行时间则自动按东八区执行
# 即+8小时故实际执行时间为18点
- cron: 0 10 * * *
jobs:
build:
runs-on: ubuntu-latest
if: github.event.repository.owner.id == github.event.sender.id
steps:
- uses: actions/checkout@master
- name: Get search.xml、sitemap.xml
env:
CFBLOG_TOKEN: ${{ secrets.CFBLOG_TOKEN }}
CFBLOG_HOST: ${{ secrets.CFBLOG_HOST }}
run: |
curl 'https://'$CFBLOG_HOST'/admin/search.xml' -H 'cfblog_token: '$CFBLOG_TOKEN'' >search.xml
curl 'https://'$CFBLOG_HOST'/admin/sitemap.xml' -H 'cfblog_token: '$CFBLOG_TOKEN'' >sitemap.xml
- name: change to branch
env:
CFBLOG_BRANCH: ${{ secrets.CFBLOG_BRANCH }}
run: |
git checkout -b $CFBLOG_BRANCH
git checkout $CFBLOG_BRANCH
- name: commit change
run: |
git config --global user.email "action@github.com"
git config --global user.name "action"
git add .
git commit -m "Update from Github Action_"`date +%Y-%m-%d`
- name: push change
env:
GITHUB_LOGIN: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
git push -f https://$GITHUB_LOGIN:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git
- name: done
run: echo 'done'

File diff suppressed because it is too large Load Diff