Skip to content

Commit 00c52cf

Browse files
committed
update
1 parent a02321f commit 00c52cf

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

.github/workflows/deploy-to-preview.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,28 @@ jobs:
2222
timeout-minutes: 10
2323
environment:
2424
name: preview
25-
url: https://font-generator-preview.pages.dev/
25+
url: ${{ steps.deployment.outputs.page_url }}
2626
steps:
2727
- uses: actions/checkout@v4
2828
- name: Install dependencies
2929
run: npm install
3030
- name: Deploy to Cloudflare Pages
3131
run: |
32-
response=$(curl -s -o /dev/null -w "%{http_code}" -X GET "https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/font-generator-preview" \
32+
response=$(curl -s -o /dev/null -w "%{http_code}" -X GET "https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/font-generator" \
3333
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}")
3434
if [ $response -eq 404 ]; then
3535
echo "Project does not exist, creating..."
36-
npx wrangler pages project create font-generator-preview --production-branch main
36+
npx wrangler pages project create font-generator --production-branch main
3737
else
3838
echo "Project exists, skipping creation."
39-
fi
40-
sed -i 's/font-generator/font-generator-preview/' wrangler.toml
41-
npm run pages:build && npx wrangler pages deploy --branch main
39+
fi
4240
env:
4341
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
4442
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
43+
44+
- name: Deploy to Cloudflare Pages
45+
uses: actions/deploy-pages@v4
46+
with:
47+
token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
48+
preview: true
49+

0 commit comments

Comments
 (0)