Skip to content

Commit

Permalink
Create daily-task.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lz0423 authored Feb 27, 2021
1 parent 6a58ba1 commit 369a49e
Showing 1 changed file with 115 additions and 0 deletions.
115 changes: 115 additions & 0 deletions .github/workerflows/daily-task.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
name: daily-task


on:

push: # push触发
branches: [ main ]
workflow_dispatch: # 手动触发
schedule: # 计划任务触发
- cron: '30 16,19 * * *' # cron表达式,Actions时区是UTC时间,所以要往前推8个小时(4-23)


jobs:
daily-task:
if: github.event.repository.owner.id == github.event.sender.id

env:
ENABLE_52POJIE: ${{secrets.ENABLE_52POJIE}}
ENABLE_BILIBILI: ${{secrets.ENABLE_BILIBILI}}
ENABLE_IQIYI: ${{secrets.ENABLE_IQIYI}}
ENABLE_UNICOM: ${{secrets.ENABLE_UNICOM}}

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12]
node-registry: ['https://registry.npmjs.org']

steps:

# 检出
- name: Checkout
uses: actions/checkout@v2

# 设置服务器时区为东八区
- name: Set time zone
run: sudo timedatectl set-timezone 'Asia/Shanghai'

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
registry-url: ${{ matrix.node-registry }}

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: restore npm cache
uses: actions/cache@v2
id: use-npm-cache
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- name: restore npm dependencies
uses: actions/cache@v2
id: use-npm-depends
with:
path: |
node_modules
*/*/node_modules
key: ${{ runner.os }}-depends-${{ hashFiles('**/package-lock.json') }}

- name: restore task cache
uses: actions/cache@v2
id: use-task-cache
with:
path: |
/home/runner/.AutoSignMachine
key: ${{ runner.os }}-task-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
if: steps.use-npm-cache.outputs.cache-hit != 'true' || steps.use-npm-depends.outputs.cache-hit != 'true'
run: npm install

# 运行 52pojie 签到任务
- name: Run 52pojie daily task
if: ${{ env.ENABLE_52POJIE }}
env:
htVD_2132_auth: ${{secrets.pojie_htVD_2132_auth}}
htVD_2132_saltkey: ${{secrets.pojie_htVD_2132_saltkey}}
run: node index.js 52pojie --htVD_2132_auth=${htVD_2132_auth} --htVD_2132_saltkey=${htVD_2132_saltkey}

# 运行 bilibili 签到任务
- name: Run bilibili daily task
if: ${{ env.ENABLE_BILIBILI }}
env:
DedeUserID: ${{secrets.bilibili_USERID}}
SESSDATA: ${{secrets.bilibili_SESSDATA}}
bili_jct: ${{secrets.bilibili_BILIJCT}}
otherConfigs: ${{secrets.bilibili_OTHERCONFIGS}}
run: node index.js bilibili --DedeUserID=${DedeUserID} --SESSDATA=${SESSDATA} --bili_jct=${bili_jct} ${otherConfigs}

# 运行 iqiyi 签到任务
- name: Run iqiyi daily task
if: ${{ env.ENABLE_IQIYI }}
env:
P00001: ${{secrets.iqiyi_P00001}}
P00PRU: ${{secrets.iqiyi_P00PRU}}
QC005: ${{secrets.iqiyi_QC005}}
dfp: ${{secrets.iqiyi_DFP}}
run: node index.js iqiyi --P00001=${P00001} --P00PRU=${P00PRU} --QC005=${QC005} --dfp=${dfp}

# 运行 unicom 签到任务
- name: Run unicom daily task
if: ${{ env.ENABLE_UNICOM }}
env:
user: ${{secrets.unicom_user}}
password: ${{secrets.unicom_password}}
appid: ${{secrets.unicom_appid}}
run: node index.js unicom --user=${user} --password=${password} --appid=${appid}

0 comments on commit 369a49e

Please sign in to comment.