From 13443e98a1489726bb9c3bf8ddf3ff91ea860e2e Mon Sep 17 00:00:00 2001 From: Ravi Kiran Date: Mon, 21 Sep 2026 16:23:43 +0530 Subject: [PATCH 1/3] Add a release workflow Nothing created releases so far: publish.yml promotes the image when a release is published, but the tag and release themselves were a manual step, and no version was ever released. The workflow follows the openops, tables and analytics release flows: the version is a dispatch input defaulting to the next patch after the latest tag, tags carry no "v" prefix, the run is gated by the release environment, and the release is created as a draft. Before tagging it checks the commit's image exists in the private registry, since the promote job imports rather than rebuilds. The version in pyproject.toml is informational, as nothing reads it, and is not bumped by a release; the file says so. Part of OPS-4863. Co-Authored-By: Claude Fable 5.1 --- .github/workflows/publish.yml | 3 +- .github/workflows/release.yml | 131 ++++++++++++++++++++++++++++++++++ README.md | 19 ++++- pyproject.toml | 1 + 4 files changed, 152 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 063b1c9..53776f5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,7 +8,8 @@ name: Publish # per arch: -, main--, main- # manifest: , main # release published -> the public registry (vars.ACR_PUBLIC_LOGIN_SERVER): , latest -# (version = tag without leading v; latest not moved by pre-releases) +# (releases are cut by release.yml; version = tag without leading v; +# latest not moved by pre-releases) # Not a rebuild: the release commit's image is imported from the # private registry, the same way the openops and tables release # flows promote a tested image. Releasing a commit therefore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6dc05d5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,131 @@ +name: Release + +# Cuts a release of the current main commit: verifies the commit's image was already +# published from main, then creates the tag and a GitHub release. Publishing the release +# is what triggers the promote job in publish.yml, which imports that image into the +# public registry as openops-mcp: (and latest). +# +# The version is chosen here, not read from a file, as in the openops, tables and +# analytics repositories: left blank it is the next patch after the latest tag, and an +# override bumps minor or major. Tags carry no "v" prefix. The version in pyproject.toml +# is informational only; nothing reads it, and it is not bumped by a release. +# +# Runs from main only: the release identity's federated credential is scoped to the release +# environment, and the image check needs that identity. + +run-name: Release ${{ inputs.version || 'next patch version' }}${{ inputs.draft && ' (draft)' || '' }} + +on: + workflow_dispatch: + inputs: + version: + type: string + description: Override the version, for example to increment minor or major (leave blank for the next patch) + draft: + type: boolean + description: Create the release as a draft (publish it by hand to promote the image) + default: true + +permissions: + contents: write + id-token: write + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + +jobs: + release: + name: Create the GitHub release + runs-on: ubuntu-latest + # Required reviewers on this environment are the approval gate for publishing. + environment: release + steps: + - uses: actions/checkout@v7.0.1 + with: + fetch-depth: 0 + + - name: Get next version + if: inputs.version == '' + id: semver + uses: flatherskevin/semver-action@9fb0c115a0bede9fa0743f4823b4182040a4983a # 1.1.5 + with: + incrementLevel: patch + source: tags + + - name: Resolve the version + id: version + env: + VERSION: ${{ inputs.version || steps.semver.outputs.nextVersion }} + run: | + set -euo pipefail + if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]]; then + echo "::error::'$VERSION' is not a bare semantic version (no leading v)" >&2 + exit 1 + fi + if git ls-remote --exit-code --tags origin "refs/tags/$VERSION" >/dev/null; then + echo "::error::Tag $VERSION already exists" >&2 + exit 1 + fi + prerelease=false + if [[ "$VERSION" == *-* ]]; then + prerelease=true + fi + { + echo "version=$VERSION" + echo "prerelease=$prerelease" + } >> "$GITHUB_OUTPUT" + + - name: Azure login + # The release identity: its federated credential is scoped to the release environment, + # and it holds Data Reader on the private registry, which is all this check needs. + uses: azure/login@v3.0.2 + with: + client-id: ${{ secrets.AZURE_ACR_RELEASE_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_TENANT_ID }} + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + + - name: Check the image for this commit exists in the private registry + # promote imports rather than rebuilds, so a commit whose main build was never + # published, or was already cleaned up, cannot be released. + env: + ACR_NAME: ${{ vars.ACR_NAME }} + ACR_LOGIN_SERVER: ${{ vars.ACR_LOGIN_SERVER }} + run: | + set -euo pipefail + : "${ACR_NAME:?must be set to the private registry name}" + short_sha="${GITHUB_SHA:0:8}" + if ! az acr manifest show-metadata --registry "$ACR_NAME" --name "openops-mcp:$short_sha" --only-show-errors >/dev/null; then + echo "::error::No image $ACR_LOGIN_SERVER/openops-mcp:$short_sha. Release a commit on main whose Publish run succeeded." >&2 + exit 1 + fi + + - name: Create the GitHub release + id: release + uses: softprops/action-gh-release@v3.0.3 + with: + target_commitish: ${{ github.sha }} + tag_name: ${{ steps.version.outputs.version }} + name: ${{ steps.version.outputs.version }} + generate_release_notes: true + draft: ${{ inputs.draft }} + prerelease: ${{ steps.version.outputs.prerelease == 'true' }} + + - name: Write summary + env: + VERSION: ${{ steps.version.outputs.version }} + DRAFT: ${{ inputs.draft }} + RELEASE_URL: ${{ steps.release.outputs.url }} + run: | + { + echo "### Release $VERSION" + echo + echo "- Commit: \`${GITHUB_SHA:0:8}\`" + echo "- Draft: \`$DRAFT\`" + echo + if [ "$DRAFT" = "true" ]; then + echo "Please [review and publish it](${RELEASE_URL/\/tags\//\/edit\/}) to promote the image to \`openops-mcp:$VERSION\` in the public registry." + else + echo "The Publish workflow is now promoting the image to \`openops-mcp:$VERSION\` in the public registry." + fi + } >> "$GITHUB_STEP_SUMMARY" diff --git a/README.md b/README.md index cbfd815..2d252ed 100644 --- a/README.md +++ b/README.md @@ -200,7 +200,8 @@ Resources → Network) and point `OPENOPS_API_URL` and `OPENOPS_MCP_ISSUER` at Published images (multi-arch, amd64 and arm64) come from the Publish workflow: releases go to `openops.azurecr.io/openops-mcp:` (and `latest`), pullable anonymously; pushes to -`main` go to the private `openopsprivate.azurecr.io/openops-mcp:main`. +`main` go to the private `openopsprivate.azurecr.io/openops-mcp:main`. See +[Releasing](#releasing) for how a release is cut. ## Configuration reference @@ -287,3 +288,19 @@ provider against a mocked API and authorization server, so the authentication pa exercised rather than stubbed. [docs/architecture.md](docs/architecture.md) covers how the pieces fit together and why. + +## Releasing + +Releases are cut with the **Release** workflow, run from `main`: + +1. Wait for the Publish run of the commit you want to release, so its image exists in the + private registry. +2. Run **Release**. Leave `version` blank for the next patch after the latest tag, or set it + to bump minor or major (with no tags yet, blank would mean `0.0.1`, so the first release + sets it explicitly). It checks the image is there, then creates the tag and a draft + GitHub release named after the version (no `v` prefix). +3. Publish the draft. That triggers the promote job, which imports the image into + `openops.azurecr.io/openops-mcp:` and moves `latest` unless the version has a + pre-release suffix. + +The `version` in `pyproject.toml` is informational; the released version is the git tag. diff --git a/pyproject.toml b/pyproject.toml index cd43244..0e7056a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,6 +4,7 @@ build-backend = "hatchling.build" [project] name = "openops-mcp" +# Informational only: the released version is the git tag (see the Release workflow). version = "0.2.0" description = "MCP server exposing OpenOps API operations as tools" requires-python = ">=3.14,<3.15" From 22410b420568abe9cc310d13c98b7c01a8ec9170 Mon Sep 17 00:00:00 2001 From: Ravi Kiran Date: Mon, 21 Sep 2026 17:09:19 +0530 Subject: [PATCH 2/3] Remove unnecessary comments and gate the workflow to main branch --- .github/workflows/release.yml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6dc05d5..81c50b5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,18 +1,5 @@ name: Release -# Cuts a release of the current main commit: verifies the commit's image was already -# published from main, then creates the tag and a GitHub release. Publishing the release -# is what triggers the promote job in publish.yml, which imports that image into the -# public registry as openops-mcp: (and latest). -# -# The version is chosen here, not read from a file, as in the openops, tables and -# analytics repositories: left blank it is the next patch after the latest tag, and an -# override bumps minor or major. Tags carry no "v" prefix. The version in pyproject.toml -# is informational only; nothing reads it, and it is not bumped by a release. -# -# Runs from main only: the release identity's federated credential is scoped to the release -# environment, and the image check needs that identity. - run-name: Release ${{ inputs.version || 'next patch version' }}${{ inputs.draft && ' (draft)' || '' }} on: @@ -37,6 +24,7 @@ concurrency: jobs: release: name: Create the GitHub release + if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest # Required reviewers on this environment are the approval gate for publishing. environment: release @@ -77,8 +65,6 @@ jobs: } >> "$GITHUB_OUTPUT" - name: Azure login - # The release identity: its federated credential is scoped to the release environment, - # and it holds Data Reader on the private registry, which is all this check needs. uses: azure/login@v3.0.2 with: client-id: ${{ secrets.AZURE_ACR_RELEASE_CLIENT_ID }} From edaeb7230f51581c2c2c31bb6202fadae3f34954 Mon Sep 17 00:00:00 2001 From: Ravi Kiran Date: Mon, 21 Sep 2026 17:52:40 +0530 Subject: [PATCH 3/3] Fix comments --- .github/workflows/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 81c50b5..c33e6af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,7 +51,7 @@ jobs: echo "::error::'$VERSION' is not a bare semantic version (no leading v)" >&2 exit 1 fi - if git ls-remote --exit-code --tags origin "refs/tags/$VERSION" >/dev/null; then + if git rev-parse --quiet --verify "refs/tags/$VERSION" >/dev/null; then echo "::error::Tag $VERSION already exists" >&2 exit 1 fi @@ -110,7 +110,8 @@ jobs: echo "- Draft: \`$DRAFT\`" echo if [ "$DRAFT" = "true" ]; then - echo "Please [review and publish it](${RELEASE_URL/\/tags\//\/edit\/}) to promote the image to \`openops-mcp:$VERSION\` in the public registry." + edit_url="$(printf '%s' "$RELEASE_URL" | sed 's#/releases/tag/#/releases/edit/#')" + echo "Please [review and publish it]($edit_url) to promote the image to \`openops-mcp:$VERSION\` in the public registry." else echo "The Publish workflow is now promoting the image to \`openops-mcp:$VERSION\` in the public registry." fi