
name: Hexo SEO Auto Push

on:
  schedule:
    - cron: 0 4 * * *
  watch:
    types: [started]
jobs:
  build:
    runs-on: ubuntu-latest
    if: github.event.repository.owner.id == github.event.sender.id || github.event_name == 'schedule'
    steps:

      - name: 1. 检查url文件
        uses: actions/checkout@v3

      - name: 2. 安装 Node
        uses: actions/setup-node@v3
        with:
          node-version: 16

      - name: 3. 安装插件
        run: |
          npm init -y
          npm install hexo-seo-autopush

      - name: 4. google 提交
        run: npx hexoautopush ${{secrets.google_client_email}} ${{secrets.google_private_key}}
      
      - name: 5. bing 提交
        run: curl -X POST "https://ssl.bing.com/webmaster/api.svc/json/SubmitUrlBatch?apikey=${{secrets.bing_apikey}}" -H "Content-Type:application/json" -H "charset:utf-8" -d @bing.json

      - name: 6. baidu 提交
        run: curl -H "Content-Type:text/plain" --data-binary @baidu.txt "http://data.zz.baidu.com/urls?site=https://www.zxma.top&token=${{secrets.baidu_token}}"
  