Skip to content

Commit b00200b

Browse files
committed
improvements
0 parents  commit b00200b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+7646
-0
lines changed

.dev.vars.example

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
UPSTASH_REDIS_REST_TOKEN=
2+
UPSTASH_REDIS_REST_URL=
3+
GA4_API_SECRET=
4+
GA4_MEASUREMENT_ID=
5+
ANALYTICS_SECRET=
6+
STRIPE_WEBHOOK_SIGNING_SECRET=
7+
STRIPE_SECRET=
8+
STRIPE_PUBLISHABLE_KEY=
9+
STRIPE_SUBSCRIPTION_PRICE_ID=
10+
STRIPE_TOPUP_PRICE_ID=

.github/workflows/wrangler.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- "*"
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
name: Deploy
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Check wrangler.toml for environments
16+
id: check-env
17+
run: |
18+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
19+
if [ ! -f "wrangler.toml" ]; then
20+
echo "env_flag=" >> $GITHUB_OUTPUT
21+
exit 0
22+
fi
23+
if grep -q "\\[env\\.${BRANCH_NAME}\\]" wrangler.toml; then
24+
echo "env_flag=--env ${BRANCH_NAME}" >> $GITHUB_OUTPUT
25+
else
26+
echo "env_flag=" >> $GITHUB_OUTPUT
27+
fi
28+
29+
- name: Sync All Secrets to Cloudflare
30+
run: |
31+
secrets_json='${{ toJSON(secrets) }}'
32+
echo "$secrets_json" | jq -r 'keys[]' | while read secret; do
33+
# Skip GITHUB_ prefixed secrets and CLOUDFLARE_API_TOKEN
34+
if [[ $secret != GITHUB_* ]] && [[ $secret != CLOUDFLARE_API_TOKEN ]]; then
35+
secret_value="${!secret}"
36+
37+
if [ -n "${{ steps.check-env.outputs.env_flag }}" ]; then
38+
echo "Setting $secret for environment ${{ steps.check-env.outputs.env_flag }}"
39+
wrangler secret put "$secret" ${{ steps.check-env.outputs.env_flag }}
40+
else
41+
echo "Setting $secret for default environment"
42+
wrangler secret put "$secret"
43+
fi
44+
fi
45+
done
46+
env: ${{ toJSON(secrets) }}
47+
48+
- name: Deploy
49+
uses: cloudflare/wrangler-action@v3
50+
with:
51+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
52+
command: deploy ${{ steps.check-env.outputs.env_flag }}

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
.DS_Store
3+
.wrangler
4+
.dev.vars

0 commit comments

Comments
 (0)