workflow.yml 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. name: ci
  2. on:
  3. push:
  4. branches:
  5. - master
  6. schedule:
  7. - cron: '00 01-23 * * *' # 每个小时运行一次
  8. env: # 设置环境变量
  9. TZ: Asia/Shanghai # 时区(设置时区可使页面中的`最近更新时间`使用时区时间)
  10. jobs:
  11. execute:
  12. runs-on: ubuntu-latest # 运行在虚拟机环境ubuntu-latest
  13. environment: test
  14. steps:
  15. - name: Checkout
  16. uses: actions/checkout@v1 # 作用:检出仓库,获取源码。
  17. - name: set-go-environment
  18. uses: actions/setup-node@v3 # uses 和 run 不能同时在一个step使用
  19. with:
  20. node-version: 14
  21. - name: build
  22. run: |
  23. npm i -g pm2
  24. npm install
  25. echo 'build success'
  26. - name: run
  27. run: |
  28. cp config.example.js config.js
  29. echo '${{secrets.MT_DEVICEID}}'
  30. sed -i 's/$COOKIE/${{secrets.MT_COOKIE}}/g' config.js
  31. sed -i 's/$DEVICEID/${{secrets.MT_DEVICEID}}/g' ./config.js
  32. chmod 777 indexAction.js
  33. node ./indexAction.js