-
Notifications
You must be signed in to change notification settings - Fork 2
Refactor release into separate child workflows with isolated deployment environments #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
7698aa9
Refactor release into multi-workflow architecture
data-douser ec08944
Publish to npmjs.org with OIDC trusted publishing
data-douser 11af206
Update .gitignore for .codeql/ and *.qlx
data-douser 7477d75
Release v2.24.1-prerelease: update versions to 2.24.1-prerelease
github-actions[bot] 6dcd891
fixresolve npm publish warnings & prerelease error
data-douser d37af97
Fixes for PR review comments
data-douser 8a5abbf
Fix release-codeql.yml workflow conditionals
data-douser ca8d456
Release v2.24.1-beta: update versions to 2.24.1-beta
github-actions[bot] 5e49a17
Release v2.24.1: update versions to 2.24.1
github-actions[bot] 62832b9
resolve npm symlinks in entry guard & fix MCP IO
data-douser 1edc84e
Release v2.24.1-prerelease: update versions to 2.24.1-prerelease
github-actions[bot] 4f5f2ca
Release v2.24.1-rc1: update versions to 2.24.1-rc1
github-actions[bot] 8a76f86
Update client and server README.md docs
data-douser 6d2fcfd
Release v2.24.1: update versions to 2.24.1
github-actions[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| name: Release CodeQL - Publish and Bundle CodeQL Packs | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| publish_codeql_packs: | ||
| default: true | ||
| description: 'Publish CodeQL tool query packs to GHCR. Disable for pre-release or re-run scenarios where packs already exist.' | ||
| required: false | ||
| type: boolean | ||
| 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-codeql-packs.outputs.release_name }} | ||
| version: | ||
| description: 'The full version string with "v" prefix (e.g., vX.Y.Z)' | ||
| value: ${{ jobs.publish-codeql-packs.outputs.version }} | ||
|
|
||
| # Note: This workflow is called exclusively via workflow_call from release.yml. | ||
| # It does NOT have a workflow_dispatch trigger to keep release.yml as the single | ||
| # entry point for all release operations. To re-publish CodeQL packs standalone, | ||
| # use workflow_dispatch on release.yml with publish_npm=false and | ||
| # create_github_release=false. | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| publish-codeql-packs: | ||
| name: Publish and Bundle CodeQL Packs | ||
| runs-on: ubuntu-latest | ||
|
|
||
| environment: release-codeql | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| outputs: | ||
| release_name: ${{ steps.version.outputs.release_name }} | ||
| version: ${{ steps.version.outputs.version }} | ||
|
|
||
| steps: | ||
| - name: CodeQL - 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: CodeQL - Checkout tag | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| ref: refs/tags/${{ steps.version.outputs.version }} | ||
|
|
||
| - name: CodeQL - Setup CodeQL environment | ||
| uses: ./.github/actions/setup-codeql-environment | ||
| with: | ||
| add-to-path: true | ||
| install-language-runtimes: false | ||
|
|
||
| - name: CodeQL - Install CodeQL pack dependencies | ||
| run: server/scripts/install-packs.sh | ||
|
|
||
| - name: CodeQL - Validate version consistency | ||
| run: | | ||
| RELEASE_NAME="${{ steps.version.outputs.release_name }}" | ||
| echo "Validating all version-bearing files match ${RELEASE_NAME}..." | ||
| ./server/scripts/update-release-version.sh --check "${RELEASE_NAME}" | ||
|
|
||
| - name: CodeQL - Publish CodeQL tool query packs | ||
| if: inputs.publish_codeql_packs | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| LANGUAGES="actions cpp csharp go java javascript python ruby swift" | ||
| echo "Publishing CodeQL tool query packs..." | ||
| for lang in ${LANGUAGES}; do | ||
| PACK_DIR="server/ql/${lang}/tools/src" | ||
| if [ -d "${PACK_DIR}" ]; then | ||
| echo "📦 Publishing ${PACK_DIR}..." | ||
| codeql pack publish --threads=-1 -- "${PACK_DIR}" | ||
| echo "✅ Published ${lang} tool query pack" | ||
| else | ||
| echo "⚠️ Skipping ${lang}: ${PACK_DIR} not found" | ||
| fi | ||
| done | ||
|
|
||
| - name: CodeQL - Skip CodeQL tool query pack publishing | ||
| if: '!inputs.publish_codeql_packs' | ||
| run: echo "⏭️ CodeQL tool query pack publishing disabled via workflow input" | ||
|
|
||
| - name: CodeQL - Bundle CodeQL tool query packs | ||
| run: | | ||
| mkdir -p dist-packs | ||
| LANGUAGES="actions cpp csharp go java javascript python ruby swift" | ||
| echo "Bundling CodeQL tool query packs..." | ||
| for lang in ${LANGUAGES}; do | ||
| PACK_DIR="server/ql/${lang}/tools/src" | ||
| if [ -d "${PACK_DIR}" ]; then | ||
| PACK_NAME="ql-mcp-${lang}-tools-src" | ||
| OUTPUT="dist-packs/${PACK_NAME}.tar.gz" | ||
| echo "📦 Bundling ${PACK_DIR} -> ${OUTPUT}..." | ||
| codeql pack bundle --threads=-1 --output="${OUTPUT}" -- "${PACK_DIR}" | ||
| echo "✅ Bundled ${PACK_NAME}" | ||
| fi | ||
| done | ||
| echo "Bundled packs:" | ||
| ls -lh dist-packs/ | ||
|
|
||
| - name: CodeQL - Upload CodeQL pack artifacts | ||
| uses: actions/upload-artifact@v6 | ||
| with: | ||
| name: codeql-tool-query-packs-${{ steps.version.outputs.version }} | ||
| path: dist-packs/*.tar.gz | ||
|
|
||
| - name: CodeQL - Summary | ||
| run: | | ||
| VERSION="${{ steps.version.outputs.version }}" | ||
| RELEASE_NAME="${{ steps.version.outputs.release_name }}" | ||
| echo "## CodeQL Packs Summary" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| if [ "${{ inputs.publish_codeql_packs }}" == "true" ]; then | ||
| echo "✅ Published CodeQL tool query packs to GHCR" >> $GITHUB_STEP_SUMMARY | ||
| else | ||
| echo "⏭️ CodeQL tool query pack publishing was disabled" >> $GITHUB_STEP_SUMMARY | ||
| fi | ||
| echo "✅ Bundled CodeQL tool query packs as artifacts" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "### Published CodeQL Packs" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Pack | Version |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| ---- | ------- |" >> $GITHUB_STEP_SUMMARY | ||
| for lang in actions cpp csharp go java javascript python ruby swift; do | ||
| echo "| \`advanced-security/ql-mcp-${lang}-tools-src\` | ${RELEASE_NAME} |" >> $GITHUB_STEP_SUMMARY | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
| 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 }} | ||
|
|
||
| # Note: This workflow is called exclusively via workflow_call from release.yml. | ||
| # It does NOT have a workflow_dispatch trigger because npm Trusted Publishing | ||
| # validates the *calling* workflow filename for OIDC. The trusted publisher on | ||
| # npmjs.com is configured with workflow "release.yml" and environment | ||
| # "release-npm". Direct dispatch would present "release-npm.yml" as the workflow | ||
| # name, causing OIDC authentication to fail. To re-publish the npm package | ||
| # standalone, use workflow_dispatch on release.yml instead. | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| publish-npm: | ||
| name: Publish npm Package | ||
| runs-on: ubuntu-latest | ||
|
|
||
| environment: release-npm | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: 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://registry.npmjs.org' | ||
|
|
||
| - name: npm - Install dependencies | ||
| run: npm ci --include=optional | ||
|
|
||
| - name: npm - Build server | ||
| run: npm run build -w server | ||
|
|
||
| - name: npm - Validate version consistency | ||
| run: | | ||
| RELEASE_NAME="${{ steps.version.outputs.release_name }}" | ||
| echo "Validating all version-bearing files match ${RELEASE_NAME}..." | ||
| ./server/scripts/update-release-version.sh --check "${RELEASE_NAME}" | ||
|
|
||
| - name: npm - Publish npm package | ||
| working-directory: server | ||
| run: | | ||
| RELEASE_NAME="${{ steps.version.outputs.release_name }}" | ||
| echo "Publishing codeql-development-mcp-server@${RELEASE_NAME} to npmjs.org via OIDC trusted publishing..." | ||
|
|
||
| # Prerelease versions (containing a hyphen) must use a dist-tag other | ||
| # than "latest" — npm enforces this to prevent prereleases from being | ||
| # installed by default. | ||
| if [[ "${RELEASE_NAME}" == *-* ]]; then | ||
| # Extract the prerelease identifier before any dot | ||
| # e.g., "2.24.1-prerelease" -> "prerelease", "2.24.1-beta.1" -> "beta" | ||
| PRERELEASE_ID="${RELEASE_NAME#*-}" | ||
| PRERELEASE_ID="${PRERELEASE_ID%%.*}" | ||
| echo "Detected prerelease version — publishing with --tag ${PRERELEASE_ID}" | ||
| npm publish --tag "${PRERELEASE_ID}" | ||
| else | ||
| npm publish | ||
| fi | ||
data-douser marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo "✅ Published npm package to npmjs.org (with provenance)" | ||
data-douser marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| - 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 | ||
data-douser marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| server/scripts/setup-packs.sh | ||
| 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 | \`codeql-development-mcp-server\` |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Version | ${RELEASE_NAME} |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Registry | npmjs.org |" >> $GITHUB_STEP_SUMMARY | ||
| echo "| Tag | ${VERSION} |" >> $GITHUB_STEP_SUMMARY | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.