-
Notifications
You must be signed in to change notification settings - Fork 5
162 lines (138 loc) · 5.46 KB
/
cli-release.yml
File metadata and controls
162 lines (138 loc) · 5.46 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: CLI Release
on:
workflow_dispatch:
inputs:
draft-release:
description: "Draft release?"
required: false
type: boolean
default: true
prerelease:
description: "Prerelease?"
required: false
type: boolean
default: true
npm-version:
description: "NPM version bump?"
required: false
type: choice
options:
- major
- minor
- patch
default: "patch"
# schedule:
# - cron: '0 12 * * 2' # Runs every Tuesday at 12:00 PM (noon) ET
permissions:
id-token: write
contents: write
jobs:
cli-release:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.AUTOMATION_USER_TOKEN }}
- name: Set Secrets
uses: DevCycleHQ/aws-secrets-action@main
with:
secrets_map: '{"MCP_KEY": "DEVCYCLE_GITHUB_cli_MCP_REGISTRY_PKEY"}'
aws_account_id: "134377926370"
- name: Set Git author
run: |
git config --global user.email "foundation-admin@devcycle.com"
git config --global user.name "DevCycle Automation"
- name: Get node version
id: get_node_version
run: |
echo "NVMRC=$(cat .nvmrc)" >> $GITHUB_OUTPUT
- run: corepack enable
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "${{ steps.get_node_version.outputs.NVMRC }}"
registry-url: "https://registry.npmjs.org"
cache: "yarn"
- name: Install dependencies
run: yarn install
- name: Build
run: yarn build
- name: Bump CLI version
run: npm version ${{ inputs.npm-version }} --force
- name: Update server.json version (pre-commit)
run: |
VERSION=$(node -p "require('./package.json').version")
jq --indent 4 --arg v "$VERSION" '.version = $v' server.json > server.json.tmp
mv server.json.tmp server.json
git add server.json
- name: Get latest tag
run: echo "LATEST_TAG=$(git describe --abbrev=0 --tags)" >> $GITHUB_ENV
- name: Commit and push tag to main branch
run: |
git add .
git commit --amend -m "Release $LATEST_TAG"
git tag -f $LATEST_TAG
git push --atomic origin main $LATEST_TAG
- name: Release
uses: ./.github/actions/release
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# cannot read $LATEST_TAG here so using ${{ env.LATEST_TAG }}
release-tag: ${{ env.LATEST_TAG }}
draft: ${{ inputs.draft-release }}
prerelease: ${{ inputs.prerelease }}
# --- Official MCP Registry (registry.modelcontextprotocol.io) Publish ---
# See docs here: https://raw.githubusercontent.com/modelcontextprotocol/registry/refs/heads/main/docs/guides/publishing/github-actions.md
- name: Install MCP Publisher
run: |
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
chmod +x mcp-publisher
- name: Sync server.json version to tag
run: |
VERSION=${LATEST_TAG#v}
jq --indent 4 --arg v "$VERSION" '.version = $v' server.json > server.json.tmp
mv server.json.tmp server.json
- name: Validate server.json schema
run: yarn validate:server
- name: Login to MCP Registry (DNS)
run: ./mcp-publisher login dns --domain devcycle.com --private-key "${MCP_KEY}"
env:
MCP_KEY: ${{ env.MCP_KEY }}
- name: Publish to MCP Registry
run: ./mcp-publisher publish
- name: Update Doc
uses: ./.github/actions/update-doc
with:
latest_tag: $LATEST_TAG
access_token: ${{ secrets.AUTOMATION_USER_TOKEN }}
- name: Update VSCode Extension
if: inputs.npm-version == 'minor' || inputs.npm-version == 'patch'
uses: ./.github/actions/update-vscode-extension
with:
latest_tag: $LATEST_TAG
access_token: ${{ secrets.AUTOMATION_USER_TOKEN }}
- name: Update GitHub Actions
if: inputs.npm-version == 'minor' || inputs.npm-version == 'patch'
uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570
with:
token: ${{ secrets.AUTOMATION_USER_TOKEN }}
repository: DevCycleHQ/feature-flag-pr-insights-action
event-type: update-cli-version
client-payload: '{"version": "${{ env.LATEST_TAG }}"}'
- name: Update GitHub Actions (Code Usages)
if: inputs.npm-version == 'minor' || inputs.npm-version == 'patch'
uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570
with:
token: ${{ secrets.AUTOMATION_USER_TOKEN }}
repository: DevCycleHQ/feature-flag-code-usage-action
event-type: update-cli-version
client-payload: '{"version": "${{ env.LATEST_TAG }}"}'
# Move this to release action yml once it works the first time
- name: Update Homebrew Formula
uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570
with:
token: ${{ secrets.AUTOMATION_USER_TOKEN }}
repository: DevCycleHQ/homebrew-cli
event-type: start-deploy