Skip to content

Deploy to Cloudflare Pages #14

Deploy to Cloudflare Pages

Deploy to Cloudflare Pages #14

Workflow file for this run

name: Deploy to Cloudflare Pages
on:
workflow_dispatch:
workflow_run:
workflows: ["Build"]
types:
- completed
jobs:
deploy-to-cloudflare:
name: Automatic Cloudflare Deploy
runs-on: ubuntu-22.04
steps:
- name: Deploy to Cloudflare
uses: ubiquity/cloudflare-deploy-action@main
with:
repository: ${{ github.repository }}
production_branch: ${{ github.event.repository.default_branch }}
build_artifact_name: "full-stack-app"
output_directory: "full-stack-app"
current_branch: ${{ github.event.workflow_run.head_branch }}
cloudflare_account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
commit_sha: ${{ github.event.workflow_run.head_sha }}
workflow_run_id: ${{ github.event.workflow_run.id }}
statics_directory: "static"
update_env_secrets_in_cloudflare:
name: Update environment secrets in Cloudflare
runs-on: ubuntu-22.04
steps:
- name: Update environment secrets in Cloudflare
run: |
REPO_NAME=$(echo "${{ github.event.repository.name }}" | tr '.' '-')
curl -X PUT \
"https://api.cloudflare.com/client/v4/accounts/${{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/${REPO_NAME}/deployment_configs" \
-H "Authorization: Bearer ${{ secrets.CLOUDFLARE_API_TOKEN }}" \
-H "Content-Type: application/json" \
--data '{
"deployment_configs": {
"production": {
"env_vars": {
"VOYAGE_API_KEY": {
"value": "${{ secrets.VOYAGEAI_API_KEY }}",
"type": "secret_text"
},
"SUPABASE_URL": {
"value": "${{ secrets.SUPABASE_URL }}",
"type": "secret_text"
},
"SUPABASE_ANON_KEY": {
"value": "${{ secrets.SUPABASE_ANON_KEY }}",
"type": "secret_text"
}
}
}
}
}'