-
Notifications
You must be signed in to change notification settings - Fork 65
73 lines (71 loc) · 2.89 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#
# Copyright (c) 2019-2023 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.18.0
- 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 "[email protected]"
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