fix: Small fixes to operator post-release workflow triggers (#995)

* fix: Fix for chectl and community-operator release workflows

Signed-off-by: Mykhailo Kuznietsov <mkuznets@redhat.com>
pull/997/head
Mykhailo Kuznietsov 2021-08-05 16:23:26 +03:00 committed by GitHub
parent b139e768a2
commit 8361ffde7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 11 deletions

View File

@ -8,6 +8,10 @@ on:
description: 'The version that is going to be released. Should be in format 7.y.z'
required: true
default: '7.y.z'
dwoVersion:
description: 'The version of DevWorkspace Operator used in the release. Should be in format v0.y.z'
required: true
default: 'v0.y.z'
forceflag:
description: 'To force creation of .x branch, use --force flag here'
default: ''
@ -47,15 +51,20 @@ jobs:
chectlVersion="${{ github.event.inputs.version }}"
fi
# To determine DWO version, we have to replace first 7. with v0.
# then major DWO version is behind upstream Che version by 26
# and the minor version is the same
# e.g 7.27.0 for Che = v0.1.0 for DWO
chectlMajorMinorVersion=${chectlVersion#7.}
chectlMajorVersion=${chectlMajorMinorVersion%.*}
dwoMajorVersion=$((${chectlMajorVersion}-26))
dwoMinorVersion=${chectlMajorMinorVersion%.*}
dwoVersion=v0.${dwoMajorVersion}.${dwoMinorVersion}
if [[ "${{ github.event.inputs.dwoVersion }}" == "" ]] || [[ "${{ github.event.inputs.dwoVersion }}" == "v0.y.z" ]]; then
# TODO using a fixed version of latest DWO release, until new DWO release workflow will be implemented
dwoVersion=v0.7.2
# the following block of code can be uncommented to automatically use the latest available version of DWO
# versions=$(curl \
# -H "Authorization: bearer ${GITHUB_TOKEN}" \
# -X POST -H "Content-Type: application/json" --data \
# '{"query": "{ repository(owner: \"devfile\", name: \"devworkspace-operator\") { refs(refPrefix: \"refs/tags/\", last: 2, orderBy: {field: TAG_COMMIT_DATE, direction: ASC}) { edges { node { name } } } } }" } ' \
# https://api.github.com/graphql)
# dwoVersion=$(echo "${versions[@]}" | jq '.data.repository.refs.edges[1].node.name | sub("\""; "")' | tr -d '"')
else
dwoVersion="${{ github.event.inputs.dwoVersion }}"
fi
# generic method to call a GH action and pass in a single var=val parameter
invokeAction() {
@ -86,4 +95,4 @@ jobs:
}
# invoke action from chectl repo
invokeAction che-incubator/chectl "Release - create pull request for upcoming release" "4008310" "version=${chectlVersion},dwoVersion=${dwoVersion}"
invokeAction che-incubator/chectl "Release - create pull request for upcoming release" "4008310" "main" "version=${chectlVersion},dwoVersion=${dwoVersion}"

View File

@ -28,7 +28,7 @@ while [[ "$#" -gt 0 ]]; do
case $1 in
'-u'|'--user') GITHUB_USER="$2"; shift 1;;
'-t'|'--token') GITHUB_TOKEN="$2"; shift 1;;
'-f'|'--force') FORCE="-f";;
'-f'|'--force') FORCE="-f"; shift 0;;
'-p'|'--platform') PLATFORMS="$2";shift 1;;
'-h'|'--help') usage;;
esac