Skip to content

CLI Release

CLI Release #94

Workflow file for this run

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 "[email protected]"
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 --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 --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 }}
# 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