Skip to content

Instantly share code, notes, and snippets.

@sortofsleepy
Last active May 20, 2024 13:12
Show Gist options
  • Save sortofsleepy/ecdcd56f67193a2e3606fe7692b1edcd to your computer and use it in GitHub Desktop.
Save sortofsleepy/ecdcd56f67193a2e3606fe7692b1edcd to your computer and use it in GitHub Desktop.
Gitlab CI deploy to cloudflare example
image: node:latest
cache:
paths:
- node_modules/
stages:
- build
compile:
stage: build
# this ensures the pipeline will only run on the default branch.
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
variables:
CLOUDFLARE_API_TOKEN: <variable name>
CLOUDFLARE_ACCOUNT_ID: <variable name>
script:
- npm install
- npm run build
- npx wrangler pages deploy
@sortofsleepy
Copy link
Author

This is a sample config for deploying to cloudflare pages with Gitlab's CI system. Though this is Gitlab specific, the general ideas should largely be transferable to other systems

This assumes project specifics re: Cloudflare are in a wrangler.toml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment