-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) · 1.49 KB
/
hexo-seo-submit.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
52
53
54
name: Hexo Seo Submit
on:
schedule:
- cron: 0 4 * * *
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: actions/setup-node@main
with:
node-version: latest
- name: check owner
id: check_owner
run: |
OWNER_TYPE=$(jq -r '.repository.owner.type' "$GITHUB_EVENT_PATH")
OWNER_ID=$(jq -r '.repository.owner.id' "$GITHUB_EVENT_PATH")
SENDER_ID=$(jq -r '.sender.id' "$GITHUB_EVENT_PATH")
if [ "$OWNER_TYPE" = "User" ] && [ "$OWNER_ID" -eq "$SENDER_ID" ]; then
echo "is_owner=true" >> $GITHUB_ENV
elif [ "$OWNER_TYPE" = "Organization" ]; then
echo "is_owner=true" >> $GITHUB_ENV
else
echo "is_owner=false" >> $GITHUB_ENV
fi
env:
GITHUB_EVENT_PATH: ${{ github.event_path }}
- run: |
npm init -y
npm install hexo-seo-submit
- name: push search engine bing
if: env.is_owner
continue-on-error: true
run: |
npx hexo-seo-submit bing -k ${{ secrets.bing_apikey }} -f bing.json
- name: push search engine google
if: env.is_owner
continue-on-error: true
run: |
npx hexo-seo-submit google -f google.txt -mail ${{ secrets.google_client_email }} -key "${{ secrets.google_private_key }}"