소스 검색

添加github Action

ggball 2 년 전
부모
커밋
e47bb4a481
1개의 변경된 파일40개의 추가작업 그리고 0개의 파일을 삭제
  1. 40 0
      .github/workflows/workflow.yml

+ 40 - 0
.github/workflows/workflow.yml

@@ -0,0 +1,40 @@
+name: ci
+
+on:
+  push:
+    branches:
+      - master
+  schedule:
+    - cron: '00 01-23 * * *' # 每三个小时运行一次
+
+env: # 设置环境变量
+  TZ: Asia/Shanghai # 时区(设置时区可使页面中的`最近更新时间`使用时区时间)
+
+
+jobs: 
+  execute:
+    runs-on: ubuntu-latest # 运行在虚拟机环境ubuntu-latest
+    environment: test
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v1 # 作用:检出仓库,获取源码。
+      - name: set-go-environment
+        uses: actions/setup-node@v3 # uses 和 run 不能同时在一个step使用
+        with:
+          node-version: 14
+      - name: build
+        run: |
+          npm i -g pm2
+          npm install
+          echo 'build success'
+      - name: run
+        run: |
+          cp config.example.js config.js
+          echo '${{secrets.MT_DEVICEID}}'
+          sed -i 's/$COOKIE/${{secrets.MT_COOKIE}}/g' config.js
+          sed -i 's/$DEVICEID/${{secrets.MT_DEVICEID}}/g' ./config.js
+          chmod 777 indexAction.js
+          node ./indexAction.js
+
+      
+