Files
edgetunnel/.github/workflows/main.yml
2022-04-08 18:25:33 +08:00

57 lines
2.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: heroku-deploy-stop-start
on:
workflow_dispatch:
inputs:
actions:
description: "action: deploy/stop/start/destroy"
default: "deploy"
heroku-region:
description: "us or eu. 如果你的app已经创建切换到不同的region需要先删除app"
default: "us"
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
region: ${{github.event.inputs.heroku-region || 'us'}}
# docker_build_args: |
# HD_UUID
env:
# 这是为了heroku注意前缀有个HD这是为了告诉heroku-deploy这些变量需要传入到 container 中。
HD_UUID: ${{ secrets.HEROKU_V2RAY_UUID }} # UUID for v2ray user, 为了安全,一定要放入 github action token 中
HD_TUNNEL_TOKEN: ${{ secrets.HEROKU_TUNNEL_TOKEN }} # token for cloudflared tunnel
NODE_ENV: production
SECRET_KEY: ${{ secrets.MY_SECRET_KEY }}
stop-start-destroy:
if: ${{ github.event.inputs.actions == 'start' || github.event.inputs.actions == 'stop' || github.event.inputs.actions == 'destroy' }}
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
if [[ ${{ github.event.inputs.actions }} == 'destroy' ]]; then heroku apps:destroy -a ${{secrets.APP_NAME}} --confirm && echo "destroy app"; fi
heroku ps -a ${{secrets.APP_NAME}}