Skip to content

Commit

Permalink
Create 多号签到.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Joinmogul authored Feb 6, 2021
1 parent 6144ee2 commit 314c3ac
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/多号签到.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: 签到

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

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

runs-on: ubuntu-latest

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

steps:

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

# 设置服务器时区为东八区
- name: Timezone CST +8
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

# 运行 unicom 签到任务
- name: Run unicom daily task
env:
user: ${{secrets.unicom_user}}
password: ${{secrets.unicom_password}}
user2: ${{secrets.unicom_user2}}
password2: ${{secrets.unicom_password2}}
user3: ${{secrets.unicom_user3}}
password3: ${{secrets.unicom_password3}}
appid: ${{secrets.unicom_appid}}
run: node index.js unicom --accountSn=1,2,3 --user-1=${user} --password-1=${password} --appid-1=${appid} --user-2=${user2} --password-2=${password2} --appid-2=${appid} --user-3=${user3} --password-3=${password3} --appid-3=${appid}

0 comments on commit 314c3ac

Please sign in to comment.