Release Che Code #64
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) 2022 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 | |
# | |
# This Workflow performs a full release of Che Code | |
name: Release Che Code | |
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 Che Code source code" | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.CHE_INCUBATOR_BOT_TOKEN }} | |
- | |
name: "Setup Node" | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- | |
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: "Tag release" | |
run: | | |
git config --global user.name "Mykhailo Kuznietsov" | |
git config --global user.email "[email protected]" | |
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 | |
#- name: Create failure MM message | |
#if: failure() | |
#run: | | |
#echo "{\"text\":\":no_entry_sign: Che Code ${{ env.BRANCH_NAME }} release has failed: https://github.com/che-incubator/che-code/actions/workflows/release.yml\"}" > mattermost.json | |
#- name: Send MM message | |
# only notify for failure, success message will be sent at the end of image-publish job | |
#if: failure() | |
#uses: mattermost/[email protected] | |
#env: | |
#MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }} | |
#MATTERMOST_CHANNEL: eclipse-che-releases | |
#MATTERMOST_USERNAME: che-bot |