-
Notifications
You must be signed in to change notification settings - Fork 29
34 lines (33 loc) · 1.88 KB
/
deploy-CloudflareWorkers.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
name: Deploy to Cloudflare Workers
on:
push:
branches:
- master
jobs:
deploy_worker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
cp wrangler.example.toml wrangler.toml
sed -i 's/account_id = ""/account_id = "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}"/' wrangler.toml
sed -i 's/TG_BOT_TOKEN = ""/TG_BOT_TOKEN = "${{ secrets.TG_BOT_TOKEN }}"/' wrangler.toml
sed -i 's/TG_WEBHOOK_SECRET_TOKEN = ""/TG_WEBHOOK_SECRET_TOKEN = "${{ secrets.TG_WEBHOOK_SECRET_TOKEN }}"/' wrangler.toml
sed -i 's/TG_BOT_OWNER_USERNAME = ""/TG_BOT_OWNER_USERNAME = "${{ secrets.TG_BOT_OWNER_USERNAME }}"/' wrangler.toml
sed -i 's/TG_BOT_ALLOW_ANYONE = ""/TG_BOT_ALLOW_ANYONE = "${{ secrets.TG_BOT_ALLOW_ANYONE }}"/' wrangler.toml
sed -i 's/R2_CUSTOM_DOMAIN = ""/R2_CUSTOM_DOMAIN = "${{ secrets.R2_CUSTOM_DOMAIN }}"/' wrangler.toml
sed -i 's/id = ""/id = "${{ secrets.CLOUDFLARE_KV_NAMESPACE_ID }}"/' wrangler.toml
sed -i 's/bucket_name = ""/bucket_name = "${{ secrets.CLOUDFLARE_BUCKET_NAME }}"/' wrangler.toml
sed -i 's/B2_KEY_ID = ""/B2_KEY_ID = "${{ secrets.B2_KEY_ID }}"/' wrangler.toml
sed -i 's/B2_SECRET_KEY = ""/B2_SECRET_KEY = "${{ secrets.B2_SECRET_KEY }}"/' wrangler.toml
sed -i 's/B2_ENDPOINT = ""/B2_ENDPOINT = "${{ secrets.B2_ENDPOINT }}"/' wrangler.toml
sed -i 's/B2_BUCKET = ""/B2_BUCKET = "${{ secrets.B2_BUCKET }}"/' wrangler.toml
sed -i 's/B2_CUSTOM_DOMAIN = ""/B2_CUSTOM_DOMAIN = "${{ secrets.B2_CUSTOM_DOMAIN }}"/' wrangler.toml
- uses: actions/setup-node@v4
with:
node-version-file: package.json
- run: npm install
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy --var VERSION:${{ github.sha }} --minify src/index.ts