che-operator/.github/workflows/release-che-docs.yml

47 lines
2.2 KiB
YAML

# This Workflow creates PRs for the release of the latest che-docs
name: Release che docs
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 che docs PRs
run: |
hub version
git config --global user.name "Mykhailo Kuznietsov"
git config --global user.email "mkuznets@redhat.com"
export GITHUB_TOKEN=${{ secrets.CHE_BOT_GITHUB_TOKEN }}
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##")
else
chedocsVersion="${{ github.event.inputs.version }}"
fi
cd /tmp
# TODO switch to master branch version, not PR version from https://github.com/eclipse/che-docs/pull/1823
curl -sSLO https://raw.githubusercontent.com/eclipse/che-docs/f634c1d49b0bc88718dcb593f75d11f45de2ba1c/make-release.sh
chmod +x make-release.sh
# fetch che-docs code, bump antora playbook file, create .x branch if not exist, and create release tag from that branch
./make-release.sh --repo git@github.com:eclipse/che-docs --version ${chedocsVersion} ${{ github.event.inputs.forceflag }} --trigger-release