File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414 uses : ./.github/workflows/wrangler-deploy.yml
1515 with :
1616 environment : production
17+ worker_name : website
1718 site_url : https://johnhooks.io
19+ domains : johnhooks.io,www.johnhooks.io
1820 ref : ${{ inputs.ref }}
1921 secrets :
2022 cloudflare_api_token : ${{ secrets.CLOUDFLARE_API_TOKEN }}
Original file line number Diff line number Diff line change 1717 uses : ./.github/workflows/wrangler-deploy.yml
1818 with :
1919 environment : staging
20+ worker_name : website-staging
2021 site_url : https://website-staging.johnhooks.workers.dev
2122 ref : ${{ inputs.ref }}
2223 secrets :
Original file line number Diff line number Diff line change 1616 type : string
1717 description : Git ref to deploy
1818 default : " "
19+ worker_name :
20+ required : true
21+ type : string
22+ description : Worker name to deploy
23+ domains :
24+ required : false
25+ type : string
26+ description : Comma-separated custom domains for this environment
27+ default : " "
1928 secrets :
2029 cloudflare_api_token :
2130 required : true
4251 SITE_URL : ${{ inputs.site_url }}
4352
4453 - name : Deploy to Cloudflare
45- run : >-
46- pnpm wrangler deploy --env ${{ inputs.environment }} --var ENVIRONMENT:${{
47- inputs.environment }} --var SITE_URL:${{ inputs.site_url }}
54+ run : |
55+ domain_args=()
56+ IFS=',' read -ra domains <<< "$DOMAINS"
57+ for domain in "${domains[@]}"; do
58+ if [[ -n "$domain" ]]; then
59+ domain_args+=(--domain "$domain")
60+ fi
61+ done
62+
63+ pnpm wrangler deploy \
64+ --env "$ENVIRONMENT" \
65+ --name "$WORKER_NAME" \
66+ "${domain_args[@]}" \
67+ --var "ENVIRONMENT:$ENVIRONMENT" \
68+ --var "SITE_URL:$SITE_URL"
4869 env :
4970 CLOUDFLARE_API_TOKEN : ${{ secrets.cloudflare_api_token }}
5071 CLOUDFLARE_ACCOUNT_ID : ${{ secrets.cloudflare_account_id }}
72+ ENVIRONMENT : ${{ inputs.environment }}
73+ WORKER_NAME : ${{ inputs.worker_name }}
74+ SITE_URL : ${{ inputs.site_url }}
75+ DOMAINS : ${{ inputs.domains }}
Original file line number Diff line number Diff line change 1919 "dev" : " astro dev" ,
2020 "build" : " astro build" ,
2121 "preview" : " astro preview" ,
22- "deploy" : " pnpm build && wrangler deploy --env production --var ENVIRONMENT:production --var SITE_URL:https://johnhooks.io" ,
23- "deploy:staging" : " pnpm build && wrangler deploy --env staging --var ENVIRONMENT:staging --var SITE_URL:https://website-staging.johnhooks.workers.dev" ,
22+ "deploy" : " pnpm build && wrangler deploy --env production --name website --domain johnhooks.io --domain www.johnhooks.io -- var ENVIRONMENT:production --var SITE_URL:https://johnhooks.io" ,
23+ "deploy:staging" : " pnpm build && wrangler deploy --env staging --name website-staging -- var ENVIRONMENT:staging --var SITE_URL:https://website-staging.johnhooks.workers.dev" ,
2424 "check" : " astro check" ,
2525 "test" : " vitest run" ,
2626 "lint" : " prettier --check . && eslint ." ,
You can’t perform that action at this time.
0 commit comments