Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ goreleaser:
REMOTE?=git@github.com:open-telemetry/opentelemetry-collector-releases.git
.PHONY: push-tags
push-tags:
@[ "${TAG}" ] || ( echo ">> env var TAG is not set"; exit 1 )
@echo "Adding tag ${TAG}"
@git tag -a ${TAG} -s -m "Version ${TAG}"
@echo "Pushing tag ${TAG}"
@git push ${REMOTE} ${TAG}
@./scripts/push-tag.sh

# Used for debug only
REMOTE?=git@github.com:open-telemetry/opentelemetry-collector-releases.git
Expand Down
46 changes: 46 additions & 0 deletions scripts/push-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

# This script creates and pushes the specified TAG to REMOTE

set -euo pipefail

if ! command -v yq &> /dev/null; then
echo "This script requires 'yq'. Please install and try again."
exit 1
fi

if [ -z "${TAG:-}" ]; then
echo "TAG must be set (e.g. TAG=v0.100.0)"
exit 1
fi
if [[ ! "${TAG}" =~ ^v.* ]]; then
echo "TAG must start with lowercase 'v' (e.g. v0.100.0)"
exit 1
fi

REMOTE="${REMOTE:-git@github.com:open-telemetry/opentelemetry-collector-releases.git}"
VALIDATE="${VALIDATE:-true}"
Comment thread
mowies marked this conversation as resolved.
VERSION="${TAG#v}"

if [ "${VALIDATE}" = "true" ]; then
for dir in distributions/*/; do
manifest="${dir}manifest.yaml"
if [ -f "${manifest}" ]; then
dist_version=$(yq '.dist.version' "${manifest}")
if [ "${dist_version}" != "${VERSION}" ]; then
echo "Version mismatch in ${manifest}: dist.version is set to '${dist_version}', expected '${VERSION}'"
echo "Please ensure the '[chore] Prepare release ${VERSION}' PR has been merged."
echo "If this version mismatch is expected, please re-run with the extra argument 'VALIDATE=false'"
exit 1
fi
fi
done
fi

echo "Adding tag ${TAG}"
git tag -a "${TAG}" -s -m "Version ${TAG}"
echo "Pushing tag ${TAG}"
git push "${REMOTE}" "${TAG}"