Skip to content

Commit

Permalink
refactor: ci/cd
Browse files Browse the repository at this point in the history
  • Loading branch information
beilunyang committed Aug 11, 2024
1 parent e5e4567 commit cc111c5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/deploy-CloudflareWorkers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
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.CLOUDFLARE_R2_CUSTOM_DOMAIN }}"/' 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.BACKBLACE_B2_KEY_ID }}"/' wrangler.toml
sed -i 's/B2_SECRET_KEY = ""/B2_SECRET_KEY = "${{ secrets.BACKBLACE_B2_SECRET_KEY }}"/' wrangler.toml
sed -i 's/B2_ENDPOINT = ""/B2_ENDPOINT = "${{ secrets.BACKBLACE_B2_ENDPOINT }}"/' wrangler.toml
sed -i 's/B2_BUCKET = ""/B2_BUCKET = "${{ secrets.BACKBLACE_B2_BUCKET }}"/' wrangler.toml
sed -i 's/B2_CUSTOM_DOMAIN = ""/B2_CUSTOM_DOMAIN = "${{ secrets.BACKBLACE_B2_CUSTOM_DOMAIN }}"/' 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
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,20 @@ bucket_name = "<string>"

要使用 GitHub Actions 部署 Cloudflare Workers,需要在 GitHub 仓库中设置以下 Secrets:

1. `CLOUDFLARE_ACCOUNT_ID`: Your Cloudflare account ID.
2. `CLOUDFLARE_API_TOKEN`: Your Cloudflare API token.
3. `TG_BOT_TOKEN`: Your Telegram bot token.
4. `TG_WEBHOOK_SECRET_TOKEN`: A secret token for the Telegram webhook.
5. `TG_BOT_OWNER_USERNAME`: The username of the Telegram bot owner.
6. `TG_BOT_ALLOW_ANYONE`: Configuration to allow anyone to use the Telegram bot.
7. `CLOUDFLARE_R2_CUSTOM_DOMAIN`: Custom domain for your Cloudflare R2 storage.
8. `CLOUDFLARE_KV_NAMESPACE_ID`: The namespace ID for your Cloudflare KV storage.
9. `CLOUDFLARE_BUCKET_NAME`: The bucket name for your Cloudflare storage.
10. `BACKBLACE_B2_KEY_ID`: Your Backblaze B2 key ID.
11. `BACKBLACE_B2_SECRET_KEY`: Your Backblaze B2 secret key.
12. `BACKBLACE_B2_ENDPOINT`: The endpoint for your Backblaze B2 storage.
13. `BACKBLACE_B2_BUCKET`: The bucket name for your Backblaze B2 storage.
14. `BACKBLACE_B2_CUSTOM_DOMAIN`: Custom domain for your Backblaze B2 storage.
- `CLOUDFLARE_ACCOUNT_ID`: Your Cloudflare account ID.
- `CLOUDFLARE_API_TOKEN`: Your Cloudflare API token.
- `CLOUDFLARE_KV_NAMESPACE_ID`: The namespace ID for your Cloudflare KV storage.
- `CLOUDFLARE_BUCKET_NAME`: The bucket name for your Cloudflare storage.
- `R2_CUSTOM_DOMAIN`: Custom domain for your Cloudflare R2 storage.
- `TG_BOT_TOKEN`: Your Telegram bot token.
- `TG_WEBHOOK_SECRET_TOKEN`: A secret token for the Telegram webhook.
- `TG_BOT_OWNER_USERNAME`: The username of the Telegram bot owner.
- `TG_BOT_ALLOW_ANYONE`: Configuration to allow anyone to use the Telegram bot.
- `B2_KEY_ID`: Your Backblaze B2 key ID.
- `B2_SECRET_KEY`: Your Backblaze B2 secret key.
- `B2_ENDPOINT`: The endpoint for your Backblaze B2 storage.
- `B2_BUCKET`: The bucket name for your Backblaze B2 storage.
- `B2_CUSTOM_DOMAIN`: Custom domain for your Backblaze B2 storage.

### 如何设置 Secrets

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"name": "img-mom",
"version": "0.1.0",
"private": true,
"engines": {
"node": ">=20.0.0"
},
"scripts": {
"dev": "wrangler dev src/index.ts",
"tunnel": "cloudflared tunnel --url http://127.0.0.1:8787",
Expand Down

0 comments on commit cc111c5

Please sign in to comment.