Skip to main content
Version: PromptQL

CI/CD

Setting up CI/CD for PromptQL projects is now streamlined with the pql-ci-cd CLI tool. This tool automatically generates GitHub Actions workflows and syncs your environment secrets to GitHub repository secrets.

Quick Setup

The fastest way to set up CI/CD for your PromptQL project is using the pql-ci-cd package:

npx pql-ci-cd

That's it! The tool will:

  • ✅ Generate GitHub Actions workflows (create-build.yml + apply-build.yml)
  • ✅ Sync secrets to GitHub (if GitHub credentials are in .env.cloud)
  • ✅ Provide clear next steps

Prerequisites

1. PromptQL Project Structure

Your project must contain a .hasura directory to be recognized as a valid PromptQL project:

your-promptql-project/
├── .hasura/ # Required - validates this is a PromptQL project
├── .env.cloud # Required - your environment variables AND GitHub credentials
└── ...

2. Environment Configuration

You must have a .env.cloud file in your project root with your actual environment variables and GitHub credentials:

# .env.cloud (should already exist with real values)
HASURA_DDN_PAT=ddn_pat_1234567890abcdef
PQL_GITHUB_TOKEN=ghp_your_github_personal_access_token
PQL_GITHUB_OWNER=your_github_username_or_org
PQL_GITHUB_REPO=your_repository_name
DATABASE_URL=your_database_url
API_KEY=your_api_key
GitHub Credentials

We use PQL_GITHUB_* prefixes to avoid conflicts with GitHub's reserved GITHUB_* environment variables. The tool reads these values and syncs them to GitHub repository secrets.

What the Tool Does

1. Generates GitHub Actions Workflows

The tool creates two workflow files:

Create Build Workflow (.github/workflows/create-build.yml)

  • Triggers on pull requests
  • Sets up PromptQL CLI
  • Uses your existing .env.cloud file (via GitHub repository secrets)
  • Creates PromptQL builds
  • Comments build results on PRs

Apply Build Workflow (.github/workflows/apply-build.yml)

  • Triggers when PRs are merged to main
  • Extracts build version from PR comments
  • Applies the build to production
  • Confirms successful deployment

2. Syncs Environment Secrets

Reads your existing .env.cloud file and uploads the variables as encrypted GitHub repository secrets, making them available to your workflows.

Complete Workflow Example

# 1. Navigate to your PromptQL project (must have .hasura directory)
cd my-promptql-project

# 2. Generate .env.cloud with your secrets using the DDN CLI
ddn supergraph build create # This generates .env.cloud file with your secrets

# 3. Add GitHub credentials to .env.cloud
echo "HASURA_DDN_PAT=ddn_pat_1234567890abcdef" >> .env.cloud
echo "PQL_GITHUB_TOKEN=ghp_your_github_personal_access_token" >> .env.cloud
echo "PQL_GITHUB_OWNER=your_github_username_or_org" >> .env.cloud
echo "PQL_GITHUB_REPO=your_repository_name" >> .env.cloud

# 4. Run the CI/CD setup tool
npx pql-ci-cd

# 5. Commit and push the generated workflows
git add .
git commit -m "Add PromptQL CI/CD workflows"
git push

# 6. Create a pull request to test the create-build workflow
# 7. Merge the PR to test the apply-build workflow

Manual Setup (Advanced)

If you prefer to set up CI/CD manually or need to customize the workflows, you can follow the generic implementation steps:

  1. Prepare a service account access token - See the service account access token section
  2. Use a Linux environment - GitHub Actions, GitLab CI, CircleCI, etc.
  3. Install and login to the DDN CLI:
    curl -L https://graphql-engine-cdn.hasura.io/ddn/cli/v4/get.sh | bash
  4. Clone your repository with the DDN supergraph metadata
  5. Set context or use flags for your DDN CLI commands
  6. Run DDN CLI commands like ddn supergraph build create and ddn supergraph build apply