forked from botpress/botpress
-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (44 loc) · 2.17 KB
/
deploy-bots.yml
File metadata and controls
52 lines (44 loc) · 2.17 KB
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
name: Deploy Bots
on: workflow_dispatch
permissions:
id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup
env:
BUGBUSTER_GITHUB_TOKEN: ${{ secrets.BUGBUSTER_GITHUB_TOKEN }}
BUGBUSTER_GITHUB_WEBHOOK_SECRET: ${{ secrets.BUGBUSTER_GITHUB_WEBHOOK_SECRET }}
BUGBUSTER_LINEAR_API_KEY: ${{ secrets.BUGBUSTER_LINEAR_API_KEY }}
BUGBUSTER_LINEAR_WEBHOOK_SIGNING_SECRET: ${{ secrets.BUGBUSTER_LINEAR_WEBHOOK_SIGNING_SECRET }}
BUGBUSTER_TELEGRAM_BOT_TOKEN: ${{ secrets.BUGBUSTER_TELEGRAM_BOT_TOKEN }}
BUGBUSTER_SLACK_REFRESH_TOKEN: ${{ secrets.BUGBUSTER_SLACK_REFRESH_TOKEN }}
BUGBUSTER_SLACK_CLIENT_ID: ${{ secrets.BUGBUSTER_SLACK_CLIENT_ID }}
BUGBUSTER_SLACK_CLIENT_SECRET: ${{ secrets.BUGBUSTER_SLACK_CLIENT_SECRET }}
BUGBUSTER_SLACK_SIGNING_SECRET: ${{ secrets.BUGBUSTER_SLACK_SIGNING_SECRET }}
CLOG_SLACK_CLIENT_ID: ${{ secrets.CLOG_SLACK_CLIENT_ID }}
CLOG_SLACK_CLIENT_SECRET: ${{ secrets.CLOG_SLACK_CLIENT_SECRET }}
CLOG_SLACK_SIGNING_SECRET: ${{ secrets.CLOG_SLACK_SIGNING_SECRET }}
CLOG_SLACK_REFRESH_TOKEN: ${{ secrets.CLOG_SLACK_REFRESH_TOKEN }}
uses: ./.github/actions/setup
- name: Deploy Bots
env:
WORKSPACE_ID: ${{ secrets.PRODUCTION_CLOUD_OPS_WORKSPACE_ID }}
TOKEN: ${{ secrets.PRODUCTION_TOKEN_CLOUD_OPS_ACCOUNT }}
run: |
api_url="https://api.botpress.cloud"
# login
echo "### Logging in to $api_url ###"
pnpm bp login -y --api-url "$api_url" --workspaceId "$WORKSPACE_ID" --token "$TOKEN"
# deploy
bots="pnpm list -F bugbuster -F clog --json"
bot_paths=$(eval "$bots" | jq -r 'map(.path) | .[]')
for bot_path in $bot_paths; do
bot_name=$(basename "$bot_path")
echo -e "\nDeploying bot: ### $bot_name ###\n"
bot_id=$(pnpm bp bots new --name "$bot_name" --json --if-not-exists | jq -r ".id")
pnpm retry -n 2 -- pnpm -F "$bot_name" -c exec -- "pnpm bp deploy -v -y --botId $bot_id"
done