diff --git a/.github/workflows/release-workflow.yaml b/.github/workflows/release-workflow.yaml index 7d4d565..35eae35 100644 --- a/.github/workflows/release-workflow.yaml +++ b/.github/workflows/release-workflow.yaml @@ -43,9 +43,20 @@ jobs: - name: Tag Release shell: bash + env: + TAG: ${{ steps.extract_build_info.outputs.tag }} run: | - git tag ${{ steps.extract_build_info.outputs.tag }} - git push origin ${{ steps.extract_build_info.outputs.tag }} + # 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 diff --git a/README.md b/README.md index e315d13..78cdc02 100644 --- a/README.md +++ b/README.md @@ -12,13 +12,29 @@ make gen ## Releasing a new version -Create and push a new release branch like this: +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. -```bash -git checkout -b releases/v1.2.3 -git push origin releases/v1.2.3 -``` +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: + +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 + ``` -A GitHub Action will create and tag a new release with the given version number. Important: the version number must be in the format `vX.Y.Z`, and prefixed with a `v`. +The release workflow finds the tag on the branch head and skips tag creation, then publishes the release notes, the Helm chart and the image. 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. 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.