-
Notifications
You must be signed in to change notification settings - Fork 2
132 lines (123 loc) · 5.46 KB
/
DeployManual.yml
File metadata and controls
132 lines (123 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
name: Publish to NPM and MCP Registry
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'tag name e.g. beta, latest etc.'
jobs:
build:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
scope: '@provartesting'
- name: Install dependencies and build
run: |
npm install -g @salesforce/cli
yarn
yarn prepack
- name: Display file
run: |
cat /home/runner/work/_temp/.npmrc
cat $NPM_CONFIG_USERCONFIG
- name: Publish package on NPM
run: npm publish --tag "$TAG" --access public
env:
TAG: ${{ github.event.inputs.tag || 'latest' }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- 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
- name: Sync version into server.json
if: github.event_name == 'release'
run: |
VERSION=${GITHUB_REF#refs/tags/v}
jq --arg v "$VERSION" '.version = $v | .packages[0].version = $v' server.json > server.tmp && mv server.tmp server.json
- name: Authenticate to MCP Registry
run: ./mcp-publisher login github-oidc
- name: Publish to MCP Registry
run: ./mcp-publisher publish
- name: Build Slack notification payload
if: success()
env:
RELEASE_BODY: ${{ github.event.release.body }}
run: |
VERSION=$(node -p "require('./package.json').version")
TAG="${{ github.event.inputs.tag || 'latest' }}"
# --- Determine change notes source ---
if [ -n "$RELEASE_BODY" ]; then
# GitHub Release body provided — use it verbatim
NOTES="$RELEASE_BODY"
else
# Auto-extract from git log since the previous tag
if [ "${{ github.event_name }}" = "release" ]; then
# Release event: HEAD is the new tag — find the nearest ancestor tag before it
PREV=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git tag --sort=-version:refname | head -1)
else
# Manual dispatch: find the nearest ancestor tag from HEAD
# (git describe respects branch ancestry; avoids pulling in commits from sibling branches)
PREV=$(git describe --tags --abbrev=0 HEAD 2>/dev/null || true)
fi
RANGE="${PREV:+${PREV}..}HEAD"
RAW=$(git log --pretty=format:"%s" "$RANGE" \
| sed 's/^[A-Z][A-Z0-9]*-[0-9]*: //' \
| grep -Ev "^(Merge |chore|bump|increment)" \
| grep -Ev "\(ci\):" \
| grep -Eiv "review comments?|merge conflict|feedback items?|test fixtures?|pre-landing|address session|address PR|session [0-9]|resolving merge|PR #[0-9]|dot\.notation|server\.tool|registerTool|bump version|increment version|testCasePath|planitem|uuid lookup|coverage (count|skew)|buildTestCase|awk regex|deploy workflow" \
| head -20)
FEATS=$(printf '%s\n' "$RAW" | grep '^feat' | sed 's/^feat[^:]*: /• /' | head -8)
FIXES=$(printf '%s\n' "$RAW" | grep '^fix' | sed 's/^fix[^:]*: /• /' | head -8)
NOTES=""
[ -n "$FEATS" ] && NOTES="*What's new:*"$'\n'"$FEATS"
if [ -n "$FIXES" ]; then
[ -n "$NOTES" ] && NOTES="${NOTES}"$'\n'
NOTES="${NOTES}*Fixes:*"$'\n'"$FIXES"
fi
[ -z "$NOTES" ] && NOTES="_No notable changes extracted._"
fi
# --- Build Block Kit JSON payload via jq (handles escaping correctly) ---
NPM_URL="https://www.npmjs.com/package/@provartesting/provardx-cli/v/${VERSION}"
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
jq -n \
--arg ver "$VERSION" \
--arg tag "$TAG" \
--arg who "${{ github.actor }}" \
--arg body "$NOTES" \
--arg npm "$NPM_URL" \
--arg run "$RUN_URL" \
'{blocks:[
{type:"header",
text:{type:"plain_text", text:("🚀 Provar MCP v"+$ver+" published"), emoji:true}},
{type:"section",
fields:[
{type:"mrkdwn", text:("*Tag:* `"+$tag+"`")},
{type:"mrkdwn", text:("*By:* "+$who)}
]},
{type:"section",
text:{type:"mrkdwn", text:$body}},
{type:"divider"},
{type:"actions",
elements:[
{type:"button", text:{type:"plain_text", text:"📦 npm", emoji:true}, url:$npm},
{type:"button", text:{type:"plain_text", text:"🔗 GitHub Run", emoji:true}, url:$run}
]}
]}' > /tmp/slack_payload.json
- name: Notify Slack
if: success()
uses: slackapi/slack-github-action@v2.0.0
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload-file-path: /tmp/slack_payload.json