Skip to content

Release - create pull request for upcoming release #108

Release - create pull request for upcoming release

Release - create pull request for upcoming release #108

Workflow file for this run

#
# Copyright (c) 2019-2021 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
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#
# This Workflow performs a full release of chectl
name: Release - create pull request for upcoming release
on:
workflow_dispatch:
inputs:
version:
description: 'The version that is going to be released. Should be in format 7.y.z. Required'
required: true
devworkspaceOperatorVersion:
description: 'The Dev Workspace Operator version. Should be in format 0.y.z. Optional'
required: false
forceRecreateTags:
description: If true, tags will be recreated. Use with caution. Optional
required: false
default: 'false'
jobs:
build:
name: Create pull request for upcoming release
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.CHE_INCUBATOR_BOT_GITHUB_TOKEN }}
- name: Install NodeJS
uses: actions/setup-node@v3
with:
node-version: 18.16.1
- 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 tag -d $VERSION || true
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: Run make-release.sh script (commit changes, create branch, create PR)
run: |
# since we're using Flavius' token below to generate PRs, should also make tags/branches/commits by same owner
# see https://github.com/che-incubator/chectl/settings/secrets/actions for the token used
git config --global user.name "Flavius Lacatusu"
git config --global user.email "flacatus@redhat.com"
export GITHUB_TOKEN=${{ secrets.CHE_INCUBATOR_BOT_GITHUB_TOKEN }}
DWO_VERSION=${{ github.event.inputs.devworkspaceOperatorVersion }}
if [[ -z ${DWO_VERSION} ]]; then
./make-release.sh --version ${{ github.event.inputs.version }}
else
./make-release.sh --version ${{ github.event.inputs.version }} --devworkspace-operator-version ${DWO_VERSION}
fi
- name: Create failure MM message
if: ${{ failure() }}
run: |
echo "{\"text\":\":no_entry_sign: Chectl ${{ github.event.inputs.version }} release PR creation failed: https://github.com/che-incubator/chectl/actions/workflows/release.yml\"}" > mattermost.json
- name: Create success MM message
run: |
echo "{\"text\":\":white_check_mark: Chectl ${{ github.event.inputs.version }} release PR has been created: https://github.com/che-incubator/chectl/pulls?q=is%3Aopen+is%3Apr+${{ github.event.inputs.version }}\"}" > mattermost.json
- name: Send MM message
if: ${{ success() }} || ${{ failure() }}
uses: mattermost/action-mattermost-notify@1.1.0
env:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_CHANNEL: eclipse-che-releases
MATTERMOST_USERNAME: che-bot