Skip to content

Commit

Permalink
Apply fixes to release workflows (#679)
Browse files Browse the repository at this point in the history
Signed-off-by: Mykhailo Kuznietsov <mkuznets@redhat.com>
  • Loading branch information
mkuznyetsov authored Feb 18, 2021
1 parent 75da259 commit 88680b7
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-che-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
set -e
# if not run manually, need to compute che docs version from latest released CSV
if [[ "${{ github.event.inputs.version }}" == "" ]] || [[ "${{ github.event.inputs.version }}" == "7.y.z" ]]; then
chedocsVersion=$(cat olm/eclipse-che-preview-openshift/deploy/olm-catalog/eclipse-che-preview-openshift/eclipse-che-preview-openshift.package.yaml | yq -r '.channels[].currentCSV' | sed -e "s#eclipse-che-preview-openshift.v##")
chedocsVersion=$yq -r '.channels[].currentCSV' olm/eclipse-che-preview-openshift/deploy/olm-catalog/eclipse-che-preview-openshift/eclipse-che-preview-openshift.package.yaml | sed -e "s#eclipse-che-preview-openshift.v##")
else
chedocsVersion="${{ github.event.inputs.version }}"
fi
Expand Down
60 changes: 60 additions & 0 deletions .github/workflows/release-chectl.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This Workflow creates PRs for the release of the latest chectl
name: Release chectl
on:
# manual trigger if required
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'
forceflag:
description: 'To force creation of .x branch, use --force flag here'
default: ''
# trigger on commit to master branch of new CSVs, eg., https://github.com/eclipse/che-operator/pull/571/files
push:
branches:
- master
paths:
- 'olm/eclipse-che-preview-*/deploy/olm-catalog/eclipse-che-preview-*/eclipse-che-preview-*.package.yaml'

jobs:
build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Release chectl PRs
run: |
hub version
git config --global user.name "Mykhailo Kuznietsov"
git config --global user.email "mkuznets@redhat.com"
export GITHUB_TOKEN=${{ secrets.CHE_INCUBATOR_BOT_GITHUB_TOKEN }}
set -e
# if not run manually, need to compute chectl version from latest released CSV
if [[ "${{ github.event.inputs.version }}" == "" ]] || [[ "${{ github.event.inputs.version }}" == "7.y.z" ]]; then
chectlVersion=$(yq -r '.channels[].currentCSV' olm/eclipse-che-preview-openshift/deploy/olm-catalog/eclipse-che-preview-openshift/eclipse-che-preview-openshift.package.yaml | sed -e "s#eclipse-che-preview-openshift.v##")
else
chectlVersion="${{ github.event.inputs.version }}"
fi
# generic method to call a GH action and pass in a single var=val parameter
invokeAction() {
this_repo=$1
this_action_name=$2
this_workflow_id=$3
this_var=$4
this_val=$5
# can compute using GH API
# workflow_id=$(curl -sSL https://api.github.com/repos/${this_repo}/actions/workflows -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" | jq --arg search_field "${this_action_name}" '.workflows[] | select(.name == $search_field).id'); # echo "workflow_id = $workflow_id"
# or just pass it in
workflow_id=$this_workflow_id
curl -sSL https://api.github.com/repos/${this_repo}/actions/workflows/${workflow_id}/dispatches -X POST -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" -d "{\"ref\":\"master\",\"inputs\": {\"${this_var}\":\"${this_val}\"} }" || die_with "[ERROR] Problem invoking action https://github.com/${this_repo}/actions?query=workflow%3A%22${this_action_name// /+}%22"
echo "[INFO] Invoked '${this_action_name}' action ($workflow_id) - see https://github.com/${this_repo}/actions?query=workflow%3A%22${this_action_name// /+}%22"
}
# invoke action from chectl repo
invokeAction che-incubator/chectl "Release - create pull request for upcoming release" "4267607" version "${chectlVersion}"
2 changes: 1 addition & 1 deletion make-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ init() {
PREPARE_COMMUNITY_OPERATORS_UPDATE=false
RELEASE_DIR=$(cd "$(dirname "$0")"; pwd)
FORCE_UPDATE=""
BUILDX_PLATFORMS="linux/amd64,linux/ppc64le,linux/s390x"
BUILDX_PLATFORMS="linux/amd64,linux/ppc64le"

if [[ $# -lt 1 ]]; then usage; exit; fi

Expand Down

0 comments on commit 88680b7

Please sign in to comment.