Deploy: CI/CD Integration
Automate deployments with GitHub Actions.
Prerequisites
Section titled “Prerequisites”- Deploy configuration in arena.yaml
- A compiled
.pack.jsoncommitted to your repository (or compiled in CI) - Cloud provider credentials configured as GitHub secrets
GitHub Actions Workflow
Section titled “GitHub Actions Workflow”Basic Deploy on Push
Section titled “Basic Deploy on Push”Deploy to production when code is pushed to the main branch:
# .github/workflows/deploy.ymlname: Deployon: push: branches: [main]
jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.22'
- name: Install PromptKit run: | go install github.com/AltairaLabs/PromptKit/tools/arena/cmd/promptarena@latest go install github.com/AltairaLabs/PromptKit/tools/packc@latest
- name: Install adapter run: promptarena deploy adapter install agentcore
- name: Compile pack run: packc compile --config arena.yaml --output app.pack.json --id my-app
- name: Deploy env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: us-west-2 run: promptarena deploy --env productionPlan on Pull Request
Section titled “Plan on Pull Request”Preview changes on pull requests without applying:
# .github/workflows/deploy-plan.ymlname: Deploy Planon: pull_request: branches: [main]
jobs: plan: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.22'
- name: Install PromptKit run: | go install github.com/AltairaLabs/PromptKit/tools/arena/cmd/promptarena@latest go install github.com/AltairaLabs/PromptKit/tools/packc@latest
- name: Install adapter run: promptarena deploy adapter install agentcore
- name: Compile pack run: packc compile --config arena.yaml --output app.pack.json --id my-app
- name: Plan deployment env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_REGION: us-west-2 run: promptarena deploy plan --env productionMulti-Environment Pipeline
Section titled “Multi-Environment Pipeline”Deploy to staging first, then production after approval:
# .github/workflows/deploy-pipeline.ymlname: Deploy Pipelineon: push: branches: [main]
jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.22'
- name: Install tools run: | go install github.com/AltairaLabs/PromptKit/tools/arena/cmd/promptarena@latest go install github.com/AltairaLabs/PromptKit/tools/packc@latest
- name: Compile pack run: packc compile --config arena.yaml --output app.pack.json --id my-app
- name: Upload pack uses: actions/upload-artifact@v4 with: name: pack path: app.pack.json
deploy-staging: needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
- name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.22'
- name: Install tools run: | go install github.com/AltairaLabs/PromptKit/tools/arena/cmd/promptarena@latest
- name: Install adapter run: promptarena deploy adapter install agentcore
- name: Download pack uses: actions/download-artifact@v4 with: name: pack
- name: Deploy to staging env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} run: promptarena deploy --env staging --pack app.pack.json
deploy-production: needs: deploy-staging runs-on: ubuntu-latest environment: production steps: - uses: actions/checkout@v4
- name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.22'
- name: Install tools run: | go install github.com/AltairaLabs/PromptKit/tools/arena/cmd/promptarena@latest
- name: Install adapter run: promptarena deploy adapter install agentcore
- name: Download pack uses: actions/download-artifact@v4 with: name: pack
- name: Deploy to production env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} run: promptarena deploy --env production --pack app.pack.jsonThe environment: production setting enables GitHub’s environment protection rules, requiring manual approval before the production deployment runs.
Makefile Integration
Section titled “Makefile Integration”Add deploy targets to your Makefile:
.PHONY: deploy-plan deploy deploy-status deploy-destroy
deploy-plan: promptarena deploy plan --env $(ENV)
deploy: promptarena deploy --env $(ENV)
deploy-status: promptarena deploy status --env $(ENV)
deploy-destroy: promptarena deploy destroy --env $(ENV)Usage:
make deploy-plan ENV=stagingmake deploy ENV=stagingmake deploy-status ENV=stagingState Management in CI
Section titled “State Management in CI”The deploy state file (.promptarena/deploy.state) is stored locally. In CI environments, state is typically not persisted between runs.
Options for CI State
Section titled “Options for CI State”Option 1: Commit state to the repository
- name: Deploy run: promptarena deploy --env production
- name: Commit state run: | git add .promptarena/deploy.state git commit -m "Update deploy state" || true git pushOption 2: Use artifact storage
- name: Download prior state uses: actions/download-artifact@v4 with: name: deploy-state continue-on-error: true
- name: Deploy run: promptarena deploy --env production
- name: Upload state uses: actions/upload-artifact@v4 with: name: deploy-state path: .promptarena/deploy.stateTroubleshooting
Section titled “Troubleshooting”Adapter not available in CI
Section titled “Adapter not available in CI”Install the adapter in your CI workflow before deploying:
- name: Install adapter run: promptarena deploy adapter install agentcoreCredentials not available
Section titled “Credentials not available”Ensure secrets are configured in your GitHub repository settings and referenced correctly:
env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}State file missing between runs
Section titled “State file missing between runs”See the state management options above. Without persisting state, each CI run treats the deployment as new.
See Also
Section titled “See Also”- Plan and Apply — Manual deployment workflows
- Configure Deploy — arena.yaml setup
- State Management — Understanding deploy state