forked from codebam/cf-workers-telegram-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (31 loc) · 1.56 KB
/
deploy.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
name: Build
on:
push:
pull_request:
repository_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- name: Publish
uses: cloudflare/wrangler-action@2.0.0
with:
accountId: ${{ secrets.CF_ACCOUNT_ID }}
apiToken: ${{ secrets.CF_API_TOKEN }}
preCommands: |
# wrangler kv:namespace create KV_BOT_STORAGE
# uncomment this for one build to enable KV
echo 'import process from"process";let a="";process.stdin.on("readable",()=>{const b=process.stdin.read();a+=null==b?"":b}),process.stdin.on("end",()=>{process.stdout.write(JSON.stringify(JSON.parse(a).filter(b=>b.title.includes("KV_BOT_STORAGE"))[0].id))});' > get_kv_id.mjs
export KV_NAMESPACE_ID=$(wrangler kv:namespace list | node get_kv_id.mjs)
echo "kv_namespaces = [{binding=\"KV_BOT_STORAGE\", id=${KV_NAMESPACE_ID}}]" >> wrangler.toml
[ -z "$SECRET_TELEGRAM_API_TOKEN" ] && echo "Secret SECRET_TELEGRAM_API_TOKEN not set, creating dummy one..." && SECRET_TELEGRAM_API_TOKEN="default-gh-action-secret" || true
secrets: |
SECRET_TELEGRAM_API_TOKEN
SECRET_TELEGRAM_API_TOKEN2
SECRET_TELEGRAM_API_TOKEN3
env:
SECRET_TELEGRAM_API_TOKEN: ${{ secrets.SECRET_TELEGRAM_API_TOKEN }}
SECRET_TELEGRAM_API_TOKEN2: ${{ secrets.SECRET_TELEGRAM_API_TOKEN2 }}
SECRET_TELEGRAM_API_TOKEN3: ${{ secrets.SECRET_TELEGRAM_API_TOKEN3 }}