Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Release Che Devfile Registry #171

Release Che Devfile Registry

Release Che Devfile Registry #171

Workflow file for this run

#
# Copyright (c) 2020-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
#
name: Release Che Devfile Registry
on:
workflow_dispatch:
inputs:
version:
description: 'release version in format 7.y.z'
required: true
forceRecreateTags:
description: If true, tags will be recreated. Use with caution
required: false
default: 'false'
performRelease:
description: If true, release will be performed (creating tag, building images)
required: false
default: 'true'
publishDevfilesToGhPages:
description: If true, will generate and publish devfiles to GitHub pages
required: false
default: 'true'
jobs:
build:
name: Create Che Devfile Registry Release
runs-on: ubuntu-22.04
steps:
-
name: "Checkout source code"
uses: actions/checkout@v4
with:
fetch-depth: 0
-
name: Check existing tags
if: github.event.inputs.performRelease == 'true'
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 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: "Set up QEMU"
uses: docker/setup-qemu-action@v3
-
name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3
-
name: "Docker quay.io Login"
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
-
name: Login to docker.io
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
-
name: Install yq
run: |
sudo wget https://github.com/mikefarah/yq/releases/download/v4.7.0/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq
-
name: Perform a release
if: github.event.inputs.performRelease == 'true'
run: |
git config --global user.name "Mykhailo Kuznietsov"
git config --global user.email "[email protected]"
export GITHUB_TOKEN=${{ secrets.CHE_BOT_GITHUB_TOKEN }}
./make-release.sh --version ${{ github.event.inputs.version}} --trigger-release
-
name: Generate devfiles with registryUrls and publish to GH pages
if: github.event.inputs.publishDevfilesToGhPages == 'true'
env:
GITHUB_TOKEN: ${{ secrets.CHE_BOT_GITHUB_TOKEN }}
VERSION: ${{ github.event.inputs.version}}
run: ./.ci/generate_and_publish_registry_url_devfiles.sh
#- name: Create failure MM message
#if: ${{ failure() }}
#run: |
#echo "{\"text\":\":no_entry_sign: Che Devfile Registry ${{ github.event.inputs.version }} release has failed: https://github.com/eclipse-che/che-devfile-registry/actions/workflows/release.yml\"}" > mattermost.json
#- name: Create success MM message
#run: |
#echo "{\"text\":\":white_check_mark: Che Devfile Registry ${{ github.event.inputs.version }} has been released: https://quay.io/eclipse/che-devfile-registry:${{ github.event.inputs.version }}\"}" > mattermost.json
#- name: Send MM message
#if: ${{ success() }} || ${{ failure() }}
#uses: mattermost/[email protected]
#env:
#MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
#MATTERMOST_CHANNEL: eclipse-che-releases
#MATTERMOST_USERNAME: che-bot