mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-23 14:41:31 +02:00
add(tag_release): Switch to tagging releases off of master.
This commit is contained in:
parent
975894ee1a
commit
243ab47a87
@ -1,47 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright (c) 2013 The CoreOS Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
SCRIPT_ROOT=$(dirname $(readlink -f "$0"))
|
||||
. "${SCRIPT_ROOT}/common.sh" || exit 1
|
||||
|
||||
DEFINE_string master "master" "Manifest master branch to update."
|
||||
DEFINE_string branch "origin/build-${TODAYS_VERSION}" \
|
||||
"Manifest branch, tag, or other ref to get version from."
|
||||
DEFINE_boolean update_sdk ${FLAGS_TRUE} \
|
||||
"Use new build as the SDK version instead of the SDK in version.txt"
|
||||
DEFINE_boolean push ${FLAGS_FALSE} "Push to public manifest repository."
|
||||
DEFINE_string remote "origin" "Remote name or URL to push to."
|
||||
|
||||
# Parse flags
|
||||
FLAGS "$@" || exit 1
|
||||
eval set -- "${FLAGS_ARGV}"
|
||||
switch_to_strict_mode
|
||||
|
||||
update_sdk_version() {
|
||||
source version.txt
|
||||
COREOS_SDK_VERSION="${COREOS_BUILD}.${COREOS_BRANCH}.${COREOS_PATCH}"
|
||||
sed -i -e '/^COREOS_SDK_VERSION=/d' version.txt
|
||||
echo "COREOS_SDK_VERSION=${COREOS_SDK_VERSION}" >> version.txt
|
||||
}
|
||||
|
||||
info "Running repo init -b ${FLAGS_master}"
|
||||
repo init -b "${FLAGS_master}"
|
||||
|
||||
info "Updating version.txt from ${FLAGS_branch}"
|
||||
cd "${GCLIENT_ROOT}/.repo/manifests"
|
||||
git fetch --all --tags
|
||||
git checkout "${FLAGS_branch}" version.txt
|
||||
if [[ ${FLAGS_update_sdk} -eq ${FLAGS_TRUE} ]]; then
|
||||
update_sdk_version
|
||||
fi
|
||||
git add version.txt
|
||||
tag=$(git describe --exact --tags "${FLAGS_branch}" 2>/dev/null || true)
|
||||
git commit -m "bump(version): Update version from ${tag:-$FLAGS_branch}"
|
||||
|
||||
if [[ ${FLAGS_push} -eq ${FLAGS_TRUE} ]]; then
|
||||
info "Pushing to ${FLAGS_remote} ${FLAGS_master}"
|
||||
git push "${FLAGS_remote}" "HEAD:refs/heads/${FLAGS_master}"
|
||||
fi
|
@ -25,30 +25,42 @@ BRANCH_NAME="build-${FLAGS_build}"
|
||||
TAG_NAME="v${FLAGS_build}.${FLAGS_branch}.${FLAGS_patch}"
|
||||
|
||||
cd "${GCLIENT_ROOT}/.repo/manifests"
|
||||
git checkout -b "${BRANCH_NAME}"
|
||||
|
||||
# Clean up existing branch manifest(s)
|
||||
if [[ $(ls branch-*.xml 2>/dev/null) ]]; then
|
||||
for old_branch in branch-*.xml; do
|
||||
if [[ "${old_branch}" != "${BRANCH_NAME}.xml" ]]; then
|
||||
git rm -f "${old_branch}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
repo manifest -o "${BRANCH_NAME}.xml" -r
|
||||
ln -sf "${BRANCH_NAME}.xml" default.xml
|
||||
tee version.txt <<EOF
|
||||
COREOS_BUILD=${FLAGS_build}
|
||||
COREOS_BRANCH=${FLAGS_branch}
|
||||
COREOS_PATCH=${FLAGS_patch}
|
||||
COREOS_SDK_VERSION=${FLAGS_sdk_version}
|
||||
EOF
|
||||
git add "${BRANCH_NAME}.xml" default.xml version.txt
|
||||
info "Creating ${BRANCH_NAME} with tag ${TAG_NAME}"
|
||||
git commit -m "add(${BRANCH_NAME}): Add branched manifest for ${TAG_NAME}"
|
||||
git tag -m "CoreOS ${TAG_NAME}" "${TAG_NAME}" "${BRANCH_NAME}"
|
||||
ln -sf "${BRANCH_NAME}.xml" release.xml
|
||||
git add "${BRANCH_NAME}.xml" release.xml version.txt
|
||||
info "Creating ${BRANCH_NAME} and tag ${TAG_NAME}"
|
||||
git commit -m "add(${BRANCH_NAME}): Add manifest for ${TAG_NAME}"
|
||||
git branch -f "${BRANCH_NAME}"
|
||||
git tag -m "CoreOS ${TAG_NAME}" "${TAG_NAME}"
|
||||
|
||||
|
||||
PUSH_TRACK=
|
||||
if [[ -n "${FLAGS_track}" ]]; then
|
||||
git branch -f "${FLAGS_track}" "${BRANCH_NAME}"
|
||||
info "Setting ${FLAGS_track} to ${BRANCH_NAME}"
|
||||
git branch -f "${FLAGS_track}"
|
||||
info "Updating track ${FLAGS_track}"
|
||||
PUSH_TRACK=1
|
||||
fi
|
||||
|
||||
if [[ ${FLAGS_push} -eq ${FLAGS_TRUE} ]]; then
|
||||
git push "${FLAGS_remote}" "refs/heads/${BRANCH_NAME}" \
|
||||
git push "${FLAGS_remote}" \
|
||||
"HEAD:refs/heads/master" \
|
||||
"refs/heads/${BRANCH_NAME}" \
|
||||
${PUSH_TRACK:+"+refs/heads/${FLAGS_track}"} \
|
||||
"refs/tags/${TAG_NAME}"
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user