Skip to content

Commit 9a2c3ad

Browse files
committed
build: update CF pages deployment
1 parent c92ce25 commit 9a2c3ad

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

.github/workflows/deploy-cloudflare.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Deploy Website to Cloudflare Pages
33
on:
44
push:
55
branches:
6+
- develop
67
- main
78
paths:
89
- 'website/**'
@@ -37,9 +38,27 @@ jobs:
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 }}

0 commit comments

Comments
 (0)