Skip to content

Commit 068040e

Browse files
committed
Refactor Cloudflare KV upload steps in GitHub Actions workflow to use environment variables for staging and production configurations, improving readability and maintainability.
1 parent 9fecff4 commit 068040e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

.github/workflows/deploy-configs.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ jobs:
5656
5757
- name: Upload staging configuration to Cloudflare KV
5858
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
59+
env:
60+
CONFIG: ${{ steps.staging-config.outputs.config }}
5961
run: |
6062
curl -X PUT "https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/storage/kv/namespaces/${{ secrets.CLOUDFLARE_KV_NAMESPACE_ID }}/values/lmrouter-config-staging" \
6163
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
6264
-H "Content-Type: application/json" \
63-
--data '${{ steps.staging-config.outputs.config }}'
65+
--data "$CONFIG"
6466
6567
- name: Process production configuration
6668
id: prod-config
@@ -73,11 +75,13 @@ jobs:
7375
7476
- name: Upload production configuration to Cloudflare KV
7577
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
78+
env:
79+
CONFIG: ${{ steps.prod-config.outputs.config }}
7680
run: |
7781
curl -X PUT "https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/storage/kv/namespaces/${{ secrets.CLOUDFLARE_KV_NAMESPACE_ID }}/values/lmrouter-config" \
7882
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
7983
-H "Content-Type: application/json" \
80-
--data '${{ steps.prod-config.outputs.config }}'
84+
--data "$CONFIG"
8185
8286
- name: Verify uploads
8387
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'

0 commit comments

Comments
 (0)