Skip to content

Commit

Permalink
deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
aigem committed Sep 11, 2024
1 parent 56202f0 commit bff140c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 25 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Deploy to Cloudflare Workers
on:
push:
branches:
- main # 或者你想触发部署的分支
- main

jobs:
deploy:
Expand All @@ -20,21 +20,16 @@ jobs:
- name: Install dependencies
run: npm install

- name: Debug Info
- name: Generate wrangler.toml
run: |
echo "Node version: $(node -v)"
echo "NPM version: $(npm -v)"
echo "Wrangler version: $(npx wrangler --version)"
echo "BUCKET_NAME: $BUCKET_NAME"
env:
BUCKET_NAME: ${{ secrets.BUCKET_NAME || 'default_bucket_name' }}
sed -e 's/$USERNAME/${{ secrets.USERNAME || 'default_username' }}/g' \
-e 's/$PASSWORD/${{ secrets.PASSWORD || 'default_g' \
-e 's/$BUCKET_NAME/${{ secrets.BUCKET_NAME || 'default_bucket_name' }}/g' \
wrangler.toml.template > wrangler.toml
cat wrangler.toml
- name: Publish to Cloudflare Workers
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy --debug
env:
USERNAME: ${{ secrets.USERNAME || 'default_username' }}
PASSWORD: ${{ secrets.PASSWORD || 'default_password' }}
BUCKET_NAME: ${{ secrets.BUCKET_NAME || 'default_bucket_name' }}

12 changes: 0 additions & 12 deletions wrangler.toml

This file was deleted.

12 changes: 12 additions & 0 deletions wrangler.toml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name = "your-worker-name"
main = "src/index.ts"
compatibility_date = "2023-01-01"

[vars]
USERNAME = "$USERNAME"
PASSWORD = "$PASSWORD"
BUCKET_NAME = "$BUCKET_NAME"

[[r2_buckets]]
binding = "BUCKET"
bucket_name = "$BUCKET_NAME"

0 comments on commit bff140c

Please sign in to comment.