Skip to content

Commit d89dce7

Browse files
authored
Add version update script & fix packs for release (#42)
1 parent d5789a1 commit d89dce7

File tree

3 files changed

+444
-22
lines changed

3 files changed

+444
-22
lines changed

.github/skills/upgrade-codeql-cli-and-packs/SKILL.md

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,25 @@ gh codeql set-version vX.XX.Y
6969
codeql version # Verify installation
7070
```
7171

72-
#### 1.3 Update package.json Versions
72+
#### 1.3 Update All Version-Bearing Files
7373

74-
All `package.json` files must have their `version` field set to match the CLI version (without the "v" prefix):
74+
Use the `update-release-version.sh` script to deterministically update `.codeql-version`, all `package.json` files, and all `codeql-pack.yml` files in a single command:
7575

76-
| File | Field to Update |
77-
| --------------------- | --------------- |
78-
| `package.json` | `version` |
79-
| `client/package.json` | `version` |
80-
| `server/package.json` | `version` |
76+
```bash
77+
./server/scripts/update-release-version.sh X.XX.Y
78+
```
79+
80+
This updates all 22 version-bearing files. Preview changes first with `--dry-run`:
81+
82+
```bash
83+
./server/scripts/update-release-version.sh --dry-run X.XX.Y
84+
```
8185

82-
Example: If `.codeql-version` is `v2.24.1`, set all `package.json` versions to `"version": "2.24.1"`.
86+
Verify consistency with `--check`:
87+
88+
```bash
89+
./server/scripts/update-release-version.sh --check X.XX.Y
90+
```
8391

8492
After updating, regenerate the lock file:
8593

@@ -125,6 +133,8 @@ Then re-verify the `cliVersion` is compatible.
125133

126134
### Phase 3: Update codeql-pack.yml Files
127135

136+
> **Note**: The `version` field in all `codeql-pack.yml` files is already updated by the `update-release-version.sh` script in Phase 1.3. This phase focuses on updating `codeql/*-all` **dependency versions** for compatibility.
137+
128138
#### 3.1 Files to Update
129139

130140
All `codeql-pack.yml` files under `server/ql/*/tools/`:

.github/workflows/release.yml

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
- 'v*'
77
workflow_dispatch:
88
inputs:
9+
publish_codeql_packs:
10+
default: true
11+
description: 'Publish CodeQL tool query packs to GHCR. Disable for pre-release or re-run scenarios where packs already exist.'
12+
required: false
13+
type: boolean
914
version:
1015
description: 'Release version (e.g., vX.Y.Z). Must start with "v".'
1116
required: true
@@ -90,23 +95,31 @@ jobs:
9095
echo "::warning::Tag ${TAG} not found, building from current checkout at ${CURRENT_SHA:0:8}"
9196
fi
9297
93-
- name: Release - Install dependencies
94-
run: npm ci --include=optional
95-
96-
- name: Release - Build server
97-
run: npm run build -w server
98-
9998
- name: Release - Setup CodeQL environment
10099
uses: ./.github/actions/setup-codeql-environment
101100
with:
102101
add-to-path: true
103102
install-language-runtimes: false
104103

104+
- name: Release - Update release version
105+
run: |
106+
TAG_VERSION="${{ steps.version.outputs.release_name }}"
107+
echo "Updating all version-bearing files to '${TAG_VERSION}'..."
108+
./server/scripts/update-release-version.sh "${TAG_VERSION}"
109+
110+
- name: Release - Install dependencies
111+
run: npm install --include=optional
112+
113+
- name: Release - Build server
114+
run: npm run build -w server
115+
105116
- name: Release - Install CodeQL pack dependencies
106117
run: server/scripts/install-packs.sh
107118

108119
- name: Release - Publish CodeQL tool query packs
109-
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
120+
if: |
121+
(startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch')
122+
&& (github.event_name != 'workflow_dispatch' || inputs.publish_codeql_packs)
110123
env:
111124
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112125
run: |
@@ -123,6 +136,10 @@ jobs:
123136
fi
124137
done
125138
139+
- name: Release - Skip CodeQL tool query pack publishing
140+
if: github.event_name == 'workflow_dispatch' && !inputs.publish_codeql_packs
141+
run: echo "⏭️ CodeQL tool query pack publishing disabled via workflow input"
142+
126143
- name: Release - Bundle CodeQL tool query packs
127144
run: |
128145
mkdir -p dist-packs
@@ -206,13 +223,19 @@ jobs:
206223
- name: Release - Summary
207224
run: |
208225
echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
209-
echo "✅ Server built successfully" >> $GITHUB_STEP_SUMMARY
210-
echo "✅ npm package published to GitHub Packages" >> $GITHUB_STEP_SUMMARY
211-
echo "✅ CodeQL tool query packs published to GHCR" >> $GITHUB_STEP_SUMMARY
212-
echo "✅ Distribution package created" >> $GITHUB_STEP_SUMMARY
213-
echo "✅ Production dependencies installed" >> $GITHUB_STEP_SUMMARY
214-
echo "✅ Archive created: codeql-development-mcp-server-${{ steps.version.outputs.version }}.tar.gz" >> $GITHUB_STEP_SUMMARY
215-
echo "✅ CodeQL tool query pack archives bundled" >> $GITHUB_STEP_SUMMARY
226+
echo "" >> $GITHUB_STEP_SUMMARY
227+
echo "| Step | Status |" >> $GITHUB_STEP_SUMMARY
228+
echo "| ---- | ------ |" >> $GITHUB_STEP_SUMMARY
229+
echo "| Server build | ✅ Success |" >> $GITHUB_STEP_SUMMARY
230+
echo "| Version validation | ✅ All files match ${{ steps.version.outputs.release_name }} |" >> $GITHUB_STEP_SUMMARY
231+
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.publish_codeql_packs }}" != "true" ]]; then
232+
echo "| CodeQL pack publish | ⏭️ Skipped (disabled via input) |" >> $GITHUB_STEP_SUMMARY
233+
else
234+
echo "| CodeQL pack publish | ✅ Published to GHCR |" >> $GITHUB_STEP_SUMMARY
235+
fi
236+
echo "| npm package | ✅ Published to GitHub Packages |" >> $GITHUB_STEP_SUMMARY
237+
echo "| Distribution archive | ✅ Created |" >> $GITHUB_STEP_SUMMARY
238+
echo "| CodeQL pack bundles | ✅ Bundled |" >> $GITHUB_STEP_SUMMARY
216239
echo "" >> $GITHUB_STEP_SUMMARY
217240
echo "### Package Contents" >> $GITHUB_STEP_SUMMARY
218241
echo "- \`server/dist/\` - Bundled JavaScript output" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)