forked from zizifn/edgetunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (53 loc) · 2.36 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: heroku-deploy-stop-start
on:
workflow_dispatch:
inputs:
actions:
description: "action: deploy/stop/start"
default: "deploy"
auto-start-stop:
description: 'if this is true, then action will run auto stop on 2:00AM and auto start on 5:00AM beijing time'
default: "true"
required: true
type: boolean
env:
description: "environment: Input the name of Environment. If left blank, the main secrets setting will be used by default."
default: ""
jobs:
heroku-deploy:
if: ${{ github.event.inputs.actions == 'deploy' || github.event.inputs.actions == ''}}
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.env }}
steps:
- run: echo APP_NAME is ${{secrets.APP_NAME}}
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.6.8 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{secrets.APP_NAME}} #Must be unique in Heroku
heroku_email: ${{secrets.EMAIL}}
usedocker: true
# docker_build_args: |
# HD_UUID
env:
# 这是为了heroku,注意前缀有个HD,这是为了告诉heroku-deploy,这些变量需要传入到container 中。
HD_UUID: ${{ secrets.HEROKU_V2RAY_UUID }} # UUID for v2ray user, 为了安全,一定要放入github action token中
NODE_ENV: production
SECRET_KEY: ${{ secrets.MY_SECRET_KEY }}
stop-start:
if: ${{ github.event.inputs.actions == 'start' || github.event.inputs.actions == 'stop' }}
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.env }}
steps:
- uses: actions/checkout@v2
- uses: akhileshns/heroku-deploy@v3.7.8 # This is the action
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{secrets.APP_NAME}} #Must be unique in Heroku
heroku_email: ${{secrets.EMAIL}}
justlogin: true
- run: |
echo action is ${{ github.event.inputs.actions }}
if [[ ${{ github.event.inputs.actions }} == 'stop' ]]; then heroku ps:scale web=0 -a ${{secrets.APP_NAME}} && echo "stop"; fi
if [[ ${{ github.event.inputs.actions }} == 'start' ]]; then heroku ps:scale web=1 -a ${{secrets.APP_NAME}} && echo "start"; fi
heroku ps -a ${{secrets.APP_NAME}}