fix: use correct Cloudflare registry URI format for containers (#4)

* fix: use correct Cloudflare registry URI format for containers

- Update wrangler.toml image path to registry.cloudflare.com format

- Fix workflow grep pattern to match new registry format

- Use secrets.CLOUDFLARE_ACCOUNT_ID in sed replacement

* fix: restore account ID placeholder before committing wrangler.toml

- Add step to replace actual account ID back to placeholder

- Prevents exposing CLOUDFLARE_ACCOUNT_ID in git history
This commit is contained in:
DIYgod 2026-01-21 21:10:10 +08:00 committed by GitHub
parent f0fe7a106e
commit 4534c74f60
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View File

@ -60,7 +60,7 @@ jobs:
- name: Get current tag from wrangler.toml
id: get-current
run: |
CURRENT_TAG=$(grep -oP 'image = "rsshub:\K[^"]+' wrangler.toml || echo "")
CURRENT_TAG=$(grep -oP 'image = "registry\.cloudflare\.com/[^/]+/rsshub:\K[^"]+' wrangler.toml || echo "")
echo "Current tag: $CURRENT_TAG"
echo "tag=$CURRENT_TAG" >> $GITHUB_OUTPUT
@ -82,7 +82,7 @@ jobs:
- name: Update wrangler.toml
if: steps.check-update.outputs.needed == 'true'
run: |
sed -i 's|image = "rsshub:[^"]*"|image = "rsshub:${{ steps.get-latest.outputs.tag }}"|' wrangler.toml
sed -i 's|image = "registry.cloudflare.com/[^/]*/rsshub:[^"]*"|image = "registry.cloudflare.com/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/rsshub:${{ steps.get-latest.outputs.tag }}"|' wrangler.toml
cat wrangler.toml
- name: Login to GitHub Container Registry
@ -114,6 +114,12 @@ jobs:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Restore placeholder in wrangler.toml before commit
if: steps.check-update.outputs.needed == 'true'
run: |
sed -i 's|image = "registry.cloudflare.com/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/rsshub:|image = "registry.cloudflare.com/CLOUDFLARE_ACCOUNT_ID/rsshub:|' wrangler.toml
cat wrangler.toml
- name: Commit updated wrangler.toml
if: steps.check-update.outputs.needed == 'true'
run: |

View File

@ -13,7 +13,7 @@ enabled = true
# Image tag will be updated by GitHub Actions
[[containers]]
class_name = "RSSHubContainer"
image = "rsshub:9aa55f54afc463b353acd59e49bd543dea788eea"
image = "registry.cloudflare.com/CLOUDFLARE_ACCOUNT_ID/rsshub:latest"
max_instances = 20
instance_type = "standard-1"