File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ name: Deploy Website to Cloudflare Pages
33on :
44 push :
55 branches :
6+ - develop
67 - main
78 paths :
89 - ' website/**'
3738 run : pnpm build
3839 working-directory : ./website
3940
41+ - name : Determine Cloudflare target
42+ id : cf-branch
43+ run : |
44+ if [ "${GITHUB_REF_NAME}" = "develop" ]; then
45+ echo "branch=preview" >> "$GITHUB_OUTPUT"
46+ echo "domain=preview.idpass-data-collect.pages.dev" >> "$GITHUB_OUTPUT"
47+ elif [ "${GITHUB_REF_NAME}" = "main" ]; then
48+ echo "branch=main" >> "$GITHUB_OUTPUT"
49+ echo "domain=idpass-data-collect.pages.dev" >> "$GITHUB_OUTPUT"
50+ else
51+ echo "Unsupported branch ${GITHUB_REF_NAME}" >&2
52+ exit 1
53+ fi
54+
55+ - name : Announce deployment target
56+ run : |
57+ echo "Deploying branch ${GITHUB_REF_NAME} to ${{ steps.cf-branch.outputs.domain }}"
58+
4059 - name : Deploy to Cloudflare Pages
4160 uses : cloudflare/wrangler-action@v3
4261 with :
4362 apiToken : ${{ secrets.CLOUDFLARE_API_TOKEN }}
4463 accountId : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
45- command : pages deploy website/build --project-name=idpass-data-collect --branch=main
64+ command : pages deploy website/build --project-name=idpass-data-collect --branch=${{ steps.cf-branch.outputs.branch }}
You can’t perform that action at this time.
0 commit comments