Repository navigation
99 lines (86 loc) · 3.28 KB
/
Copy pathdeploy.yml
File metadata and controls
99 lines (86 loc) · 3.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: Deploy
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
env:
PULUMI_VERSION: "3.197.0"
jobs:
deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest
# workflow_dispatch can target any ref; only main is deployed
if: github.ref == 'refs/heads/main'
environment: production
concurrency:
group: deploy-production
cancel-in-progress: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Setup Pulumi
uses: pulumi/actions@v6
with:
pulumi-version: ${{ env.PULUMI_VERSION }}
- name: Cache Pulumi plugins
uses: actions/cache@v4
with:
path: ~/.pulumi/plugins
key: pulumi-plugins-${{ hashFiles('Pulumi.yaml') }}
restore-keys: |
pulumi-plugins-
- name: Install Pulumi packages
env:
GITHUB_TOKEN: ${{ github.token }}
run: pulumi install
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_PROD_SERVICE_ACCOUNT_KEY }}
# Minted as late as possible: installation tokens expire after one hour.
# `owner` is required; without it the token only covers this repository.
- name: Create GitHub App token
id: app-token
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
with:
client-id: ${{ vars.DEPLOY_APP_CLIENT_ID }}
private-key: ${{ secrets.DEPLOY_APP_PRIVATE_KEY }}
owner: modelcontextprotocol
permission-administration: write
permission-members: write
permission-metadata: read
permission-organization-administration: write
permission-organization-custom-org-roles: read
permission-pages: read
- name: Deploy to Production
env:
PULUMI_PASSPHRASE: ${{ secrets.PULUMI_PROD_PASSPHRASE }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
ORG_BILLING_EMAIL: ${{ secrets.ORG_BILLING_EMAIL }}
DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
DISCORD_GUILD_ID: ${{ secrets.DISCORD_GUILD_ID }}
CLOUDFLARE_ROLE_MANAGEMENT_TOKEN: ${{ secrets.CLOUDFLARE_ROLE_MANAGEMENT_TOKEN }}
run: |
echo "$PULUMI_PASSPHRASE" > passphrase.prod.txt
export PULUMI_CONFIG_PASSPHRASE_FILE=passphrase.prod.txt
pulumi login gs://mcp-access-prod-pulumi-state
pulumi config set discord:guildId "$DISCORD_GUILD_ID" --stack prod
pulumi config set discord:botToken "$DISCORD_BOT_TOKEN" --secret --stack prod
pulumi config set githubBillingEmail "$ORG_BILLING_EMAIL" --secret --stack prod
# Cloudflare Access is optional until the CLOUDFLARE_ROLE_MANAGEMENT_TOKEN secret exists
if [ -n "$CLOUDFLARE_ROLE_MANAGEMENT_TOKEN" ]; then
pulumi config set cloudflare:roleManagementToken "$CLOUDFLARE_ROLE_MANAGEMENT_TOKEN" --secret --stack prod
fi
make up