forked from gdtool/cloudflare-workers-blog
-
Notifications
You must be signed in to change notification settings - Fork 63
51 lines (42 loc) · 1.48 KB
/
actions-cfblog.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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'