Release Che Docs #78
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Copyright (c) 2024 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 | |
# | |
# Perform release of Che Docs | |
name: Release Che Docs | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version that is going to be released. Should be in format 7.y.z' | |
required: true | |
default: '' | |
forceRecreateTags: | |
description: If true, tags will be recreated. Use with caution | |
required: false | |
default: 'false' | |
jobs: | |
build: | |
name: Create Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check existing tags | |
run: | | |
set +e | |
RECREATE_TAGS=${{ github.event.inputs.forceRecreateTags }} | |
git ls-remote --exit-code origin refs/tags/${{ github.event.inputs.version}} | |
TAG_EXISTS=$? | |
if [[ $TAG_EXISTS -eq 0 ]]; then | |
if [[ $RECREATE_TAGS == "true" ]]; then | |
echo "[INFO] Recreating tags for ${{ github.event.inputs.version}} version" | |
git push origin :${{ github.event.inputs.version}} | |
else | |
echo "[ERROR] Cannot proceed with release - tag already exists" | |
fi | |
fi | |
- name: Set up yq | |
run: | | |
python -m pip install --upgrade pip | |
pip install yq | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to quay.io | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
registry: quay.io | |
- name: Create Release | |
env: | |
GH_TOKEN: ${{ secrets.CHE_BOT_GITHUB_TOKEN }} | |
run: | | |
git config --global user.name "Mykhailo Kuznietsov" | |
git config --global user.email "[email protected]" | |
export GITHUB_TOKEN=${{ secrets.CHE_BOT_GITHUB_TOKEN }} | |
/bin/bash make-release.sh --version ${{ github.event.inputs.version }} --trigger-release | |
- name: Publish release image | |
run: | | |
git checkout ${{ github.event.inputs.version }} | |
SHORT_SHA1=$(git rev-parse --short=7 HEAD) | |
docker buildx build --platform linux/amd64 -f Containerfile --push -t quay.io/eclipse/che-docs:${SHORT_SHA1} -t quay.io/eclipse/che-docs:${{ github.event.inputs.version }} . |