-
Notifications
You must be signed in to change notification settings - Fork 2
106 lines (92 loc) · 3.32 KB
/
release-npm.yml
File metadata and controls
106 lines (92 loc) · 3.32 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
name: Release npm - Publish npm Package
on:
workflow_call:
inputs:
version:
description: 'Release version tag (e.g., vX.Y.Z). Must start with "v".'
required: true
type: string
outputs:
release_name:
description: 'The release name without "v" prefix (e.g., X.Y.Z)'
value: ${{ jobs.publish-npm.outputs.release_name }}
version:
description: 'The full version string with "v" prefix (e.g., vX.Y.Z)'
value: ${{ jobs.publish-npm.outputs.version }}
workflow_dispatch:
inputs:
version:
description: 'Release version tag (e.g., vX.Y.Z). Must start with "v". Tag must already exist.'
required: true
type: string
permissions:
contents: read
jobs:
publish-npm:
name: Publish npm Package
runs-on: ubuntu-latest
environment: release-npm
permissions:
contents: read
packages: write
outputs:
release_name: ${{ steps.version.outputs.release_name }}
version: ${{ steps.version.outputs.version }}
steps:
- name: npm - Validate and parse version
id: version
run: |
VERSION="${{ inputs.version }}"
if [[ ! "${VERSION}" =~ ^v ]]; then
echo "::error::Version '${VERSION}' must start with 'v'"
exit 1
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "release_name=${VERSION#v}" >> $GITHUB_OUTPUT
- name: npm - Checkout tag
uses: actions/checkout@v6
with:
ref: refs/tags/${{ steps.version.outputs.version }}
- name: npm - Setup Node.js
uses: actions/setup-node@v6
with:
cache: 'npm'
node-version-file: '.node-version'
registry-url: 'https://npm.pkg.github.com'
scope: '@advanced-security'
- name: npm - Install dependencies
run: npm ci --include=optional
- name: npm - Build server
run: npm run build -w server
- name: npm - Publish npm package
working-directory: server
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "Publishing @advanced-security/codeql-development-mcp-server to GitHub Packages..."
npm publish
echo "✅ Published npm package to GitHub Packages"
- name: npm - Upload release build artifact
uses: actions/upload-artifact@v6
with:
name: release-build-${{ steps.version.outputs.version }}
path: |
.node-version
server/dist/
server/ql/
server/package.json
README.md
LICENSE
docs/
- name: npm - Summary
run: |
VERSION="${{ steps.version.outputs.version }}"
RELEASE_NAME="${{ steps.version.outputs.release_name }}"
echo "## npm Package Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Detail | Value |" >> $GITHUB_STEP_SUMMARY
echo "| ------ | ----- |" >> $GITHUB_STEP_SUMMARY
echo "| Package | \`@advanced-security/codeql-development-mcp-server\` |" >> $GITHUB_STEP_SUMMARY
echo "| Version | ${RELEASE_NAME} |" >> $GITHUB_STEP_SUMMARY
echo "| Registry | GitHub Packages |" >> $GITHUB_STEP_SUMMARY
echo "| Tag | ${VERSION} |" >> $GITHUB_STEP_SUMMARY