diff --git a/.github/workflows/release-workflow.yaml b/.github/workflows/release-workflow.yaml index 61a8777..57b34b6 100644 --- a/.github/workflows/release-workflow.yaml +++ b/.github/workflows/release-workflow.yaml @@ -1,8 +1,8 @@ name: Release on: push: - branches: - - 'releases/v**' + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' permissions: contents: read @@ -20,6 +20,16 @@ jobs: steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + + - name: Require the tagged commit to be on main + run: | + git fetch --no-tags origin main + if ! git merge-base --is-ancestor HEAD origin/main; then + echo "::error::$(git rev-parse --short HEAD) is not in the history of main; releases are cut from main only" + exit 1 + fi - name: Extract build info id: extract_build_info @@ -42,23 +52,6 @@ jobs: # Ensure correct versions in Chart.yaml helm package --app-version ${{ steps.extract_build_info.outputs.tag }} --version ${{ steps.extract_build_info.outputs.tag }} charts/qdrant-kubernetes-api/ - - name: Tag Release - shell: bash - env: - TAG: ${{ steps.extract_build_info.outputs.tag }} - run: | - # The peeled ref (^{}) is the commit for an annotated tag; lightweight tags only have the direct ref. - remote_sha="$(git ls-remote --tags origin "refs/tags/${TAG}" "refs/tags/${TAG}^{}" | tail -n1 | cut -f1)" - if [ -z "${remote_sha}" ]; then - git tag "${TAG}" - git push origin "${TAG}" - elif [ "${remote_sha}" = "$(git rev-parse HEAD)" ]; then - echo "Tag ${TAG} already exists on HEAD, skipping" - else - echo "::error::Tag ${TAG} exists on ${remote_sha}, not on HEAD $(git rev-parse HEAD)" - exit 1 - fi - - name: Publish Release Notes uses: release-drafter/release-drafter@978bb0b30c5ee8cdd332ced253758157150d43f0 # v7.10.0 with: diff --git a/AGENTS.md b/AGENTS.md index 7b6ed73..8a05537 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -59,6 +59,6 @@ see `docs/api.md` for all resources. - Name branches `feature/...` (or `feat/...`), `fix/...` or `chore/...`. The PR label is set from the branch name, and release notes are grouped by that label. -- A release needs a `vX.Y.Z` tag pushed by a cloud-admin, then a push to a `releases/vX.Y.Z` - branch on the same commit. CI publishes the GitHub release and the chart. Steps are in - `README.md`. +- A release is a `vX.Y.Z` tag on a commit in `main`, pushed by a cloud-admin. The release job runs + in the `release` environment after a reviewer approves it, then publishes the GitHub release and + the chart. Steps are in `README.md`. diff --git a/README.md b/README.md index 1a94ab8..dcf6b8c 100644 --- a/README.md +++ b/README.md @@ -12,29 +12,15 @@ make gen ## Releasing a new version -Releases are built from a `releases/vX.Y.Z` branch. The version must be in the format `vX.Y.Z`, prefixed with a `v`, because this repository is a Go module. +A release is built from a `vX.Y.Z` tag on a commit in `main`. The version must be in the format `vX.Y.Z`, prefixed with a `v`, because this repository is a Go module. -Only members of `cloud-admins` can create `v*` tags (SEC-41 tag ruleset), so the tag is pushed by a cloud-admin before the release branch: +Only members of `cloud-admins` can create `v*` tags (SEC-41 tag ruleset). If you are not a cloud-admin, send one the commit SHA to release: -1. Create the release branch locally from the commit to release: - - ```bash - git checkout -b releases/v1.2.3 - ``` - -2. Ask a cloud-admin to tag that commit and push the tag. If you are not a cloud-admin, send them the commit SHA: - - ```bash - git tag -a v1.2.3 -m v1.2.3 - git push origin refs/tags/v1.2.3 - ``` - -3. Push the release branch: - - ```bash - git push origin releases/v1.2.3 - ``` +```bash +git tag -a v1.2.3 -m v1.2.3 +git push origin refs/tags/v1.2.3 +``` -The release workflow finds the tag on the branch head and skips tag creation, then publishes the release notes and the Helm chart. If the branch was pushed before the tag, the run fails at the tag step; push the tag and re-run the failed job. A tag that exists on a different commit fails the release. +The tag push starts the release workflow in the `release` environment, which needs an approval from a reviewer. The workflow fails if the tagged commit is not in the history of `main`. After the approval, it publishes the release notes and the Helm chart. Deployment to different environments is coupled with operator release, please see [qdrant/operator: Release process](https://github.com/qdrant/operator?tab=readme-ov-file#release-process) for details.