Release #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright (c) 2024 Red Hat, Inc. | |
# This program and the accompanying materials are made | |
# available under the terms of the Eclipse Public License 2.0 | |
# which is available at https://www.eclipse.org/legal/epl-2.0/ | |
# | |
# SPDX-License-Identifier: EPL-2.0 | |
# | |
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version that is going to be released. Should be in format 7.y.z' | |
required: true | |
default: '7.y.z' | |
forceRecreateTags: | |
description: If true, tags will be recreated. Use with caution | |
required: false | |
default: 'false' | |
jobs: | |
tag-release: | |
runs-on: ubuntu-22.04 | |
steps: | |
- | |
name: "Checkout the source code" | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.CHE_INCUBATOR_BOT_TOKEN }} | |
- | |
name: Check existing tags | |
run: | | |
set +e | |
RECREATE_TAGS=${{ github.event.inputs.forceRecreateTags }} | |
VERSION=${{ github.event.inputs.version }} | |
EXISTING_TAG=$(git ls-remote --exit-code origin refs/tags/${VERSION}) | |
if [[ -n ${EXISTING_TAG} ]]; then | |
if [[ ${RECREATE_TAGS} == "true" ]]; then | |
echo "[INFO] Removing tag for ${VERSION} version. New tag will be recreated during release." | |
git push origin :$VERSION | |
else | |
echo "[ERROR] Cannot proceed with release - tag ${EXISTING_TAG} already exists." | |
exit 1 | |
fi | |
else | |
echo "[INFO] No existing tags detected for $VERSION" | |
fi | |
- name: Set up environment | |
run: | | |
sudo apt-get update -y || true | |
sudo apt-get -y -q install hub | |
hub --version | |
- | |
name: "Tag release" | |
run: | | |
git config --global user.name "Mykhailo Kuznietsov" | |
git config --global user.email "mkuznets@redhat.com" | |
git config --global pull.rebase true | |
export GITHUB_TOKEN=${{ secrets.CHE_INCUBATOR_BOT_TOKEN }} | |
/bin/bash make-release.sh --version ${{ github.event.inputs.version }} --tag-release |