Skip to content

Commit f5ed872

Browse files
authored
Split deploying to prod and staging (#666)
<!-- Provide a brief summary of your changes --> ## Motivation and Context <!-- Why is this change needed? What problem does it solve? --> The following PR splits the workflows for deploying to prod and staging easing the use of gitops flows for promotions. ## How Has This Been Tested? <!-- Have you tested this in a real application? Which scenarios were tested? --> ## Breaking Changes <!-- Will users need to update their code or configurations? --> ## Types of changes <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [ ] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [ ] My code follows the repository's style guidelines - [ ] New and existing tests pass locally - [ ] I have added appropriate error handling - [ ] I have added or updated documentation as needed ## Additional context <!-- Add any other context, implementation notes, or design decisions --> Signed-off-by: Radoslav Dimitrov <[email protected]>
1 parent 3592b2c commit f5ed872

File tree

4 files changed

+91
-50
lines changed

4 files changed

+91
-50
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Deploy to Production
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'deploy/Pulumi.gcpProd.yaml'
9+
10+
permissions:
11+
contents: read
12+
13+
env:
14+
PULUMI_VERSION: "3.188.0"
15+
16+
jobs:
17+
deploy-production:
18+
name: Deploy to Production
19+
runs-on: ubuntu-latest
20+
environment: production
21+
concurrency:
22+
group: deploy-production
23+
cancel-in-progress: false
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
27+
28+
- name: Setup Go
29+
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
30+
with:
31+
go-version-file: 'go.mod'
32+
cache: true
33+
34+
- name: Setup Pulumi
35+
uses: pulumi/actions@d7ceb0215da5a14ec84f50b703365ddf0194a9c8
36+
with:
37+
pulumi-version: ${{ env.PULUMI_VERSION }}
38+
39+
- name: Authenticate to Google Cloud
40+
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093
41+
with:
42+
credentials_json: ${{ secrets.GCP_PROD_SERVICE_ACCOUNT_KEY }}
43+
44+
- name: Setup Google Cloud SDK
45+
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db
46+
with:
47+
project_id: mcp-registry-prod
48+
install_components: gke-gcloud-auth-plugin
49+
50+
- name: Deploy to Production
51+
working-directory: ./deploy
52+
env:
53+
PULUMI_PROD_PASSPHRASE: ${{ secrets.PULUMI_PROD_PASSPHRASE }}
54+
run: |
55+
echo "$PULUMI_PROD_PASSPHRASE" > passphrase.prod.txt
56+
make prod-up
Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
name: Deploy
1+
name: Deploy to Staging
22

33
on:
44
push:
55
branches:
66
- main
7+
paths-ignore:
8+
- 'deploy/Pulumi.gcpProd.yaml'
79

810
permissions:
911
contents: read
@@ -94,45 +96,3 @@ jobs:
9496
run: |
9597
echo "$PULUMI_STAGING_PASSPHRASE" > passphrase.staging.txt
9698
make staging-up
97-
98-
deploy-production:
99-
name: Deploy to Production
100-
runs-on: ubuntu-latest
101-
environment: production
102-
needs: deploy-staging
103-
concurrency:
104-
group: deploy-production
105-
cancel-in-progress: false
106-
steps:
107-
- name: Checkout code
108-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
109-
110-
- name: Setup Go
111-
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
112-
with:
113-
go-version-file: 'go.mod'
114-
cache: true
115-
116-
- name: Setup Pulumi
117-
uses: pulumi/actions@d7ceb0215da5a14ec84f50b703365ddf0194a9c8
118-
with:
119-
pulumi-version: ${{ env.PULUMI_VERSION }}
120-
121-
- name: Authenticate to Google Cloud
122-
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093
123-
with:
124-
credentials_json: ${{ secrets.GCP_PROD_SERVICE_ACCOUNT_KEY }}
125-
126-
- name: Setup Google Cloud SDK
127-
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db
128-
with:
129-
project_id: mcp-registry-prod
130-
install_components: gke-gcloud-auth-plugin
131-
132-
- name: Deploy to Production
133-
working-directory: ./deploy
134-
env:
135-
PULUMI_PROD_PASSPHRASE: ${{ secrets.PULUMI_PROD_PASSPHRASE }}
136-
run: |
137-
echo "$PULUMI_PROD_PASSPHRASE" > passphrase.prod.txt
138-
make prod-up

deploy/README.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,34 @@ PULUMI_CONFIG_PASSPHRASE="" pulumi config set mcp-registry:githubClientSecret --
2929

3030
### Production Deployment (GCP)
3131

32-
**Note:** The production deployment is automatically handled by GitHub Actions. All merges to the `main` branch trigger an automatic deployment the `staging` environment at GCP via [the configured GitHub Actions workflow](../.github/workflows/deploy.yml).
32+
**Note:** Deployments are automatically handled by GitHub Actions with separate workflows for staging and production:
3333

34-
**Important:** Deployment to `prod` require explicit configuration of the Docker image tag in `Pulumi.gcpProd.yaml`. This prevents automatic promotion of new releases and provides manual control over production versions. To deploy a specific version:
34+
- **Staging:** All merges to the `main` branch automatically build and deploy the latest code to the `staging` environment via [deploy-staging.yml](../.github/workflows/deploy-staging.yml). Staging always uses the `:main` Docker image tag.
3535

36-
1. Update `mcp-registry:imageTag` in `Pulumi.gcpProd.yaml` to the desired version (e.g., `v1.0.0`, `main-20250930-abc123d`)
37-
2. Commit the changes and open a PR to `main`
38-
3. Once merged, the GitHub Actions workflow will deploy the specified version
36+
- **Production:** Deployment requires explicit configuration of the Docker image tag in `Pulumi.gcpProd.yaml` and is triggered automatically via [deploy-production.yml](../.github/workflows/deploy-production.yml) when this config file is pushed to `main`. This GitOps-style approach provides manual control and an audit trail for production versions.
3937

40-
The steps below are preserved as a log of what we did, or if a manual override is needed.
38+
**To deploy a specific version to production:**
39+
40+
1. Cut a release (if deploying a new version):
41+
```bash
42+
# Via GitHub UI: https://github.com/modelcontextprotocol/registry/releases
43+
# Or via gh CLI:
44+
gh release create v1.2.3 --generate-notes
45+
```
46+
This builds Docker images tagged as `v1.2.3` and `latest`
47+
48+
2. Update the production image tag in `Pulumi.gcpProd.yaml`:
49+
```bash
50+
# Edit deploy/Pulumi.gcpProd.yaml
51+
# Change line: mcp-registry:imageTag: v1.2.3
52+
git add deploy/Pulumi.gcpProd.yaml
53+
git commit -m "Deploy v1.2.3 to production"
54+
git push
55+
```
56+
57+
3. The production deployment workflow will automatically trigger and deploy the specified version
58+
59+
**Manual Override:** The steps below are preserved if a manual deployment override is needed.
4160

4261
Pre-requisites:
4362
- [Pulumi CLI installed](https://www.pulumi.com/docs/iac/download-install/)

docs/guides/contributing/releasing.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ The release workflow will automatically:
2121
- `ghcr.io/modelcontextprotocol/registry:vX.Y.Z` - Specific release version
2222
- Binaries can be downloaded from the GitHub release page
2323

24-
**Note:** Releases do not automatically deploy to production. See the [deployment documentation](../../deploy/README.md) for production deployment instructions.
24+
**Note:** Releases do not automatically deploy to production. To deploy a release to production:
25+
26+
1. Update `mcp-registry:imageTag` in `deploy/Pulumi.gcpProd.yaml` to the desired version (e.g., `v1.2.3`)
27+
2. Commit and push the change to the `main` branch
28+
3. The [deploy-production.yml](../../../.github/workflows/deploy-production.yml) workflow will automatically trigger and deploy the specified version
29+
30+
See the [deployment documentation](../../../deploy/README.md) for more details.
2531

2632
## Docker Image Tags
2733

0 commit comments

Comments
 (0)