Skip to content

Release Che Configbump #22

Release Che Configbump

Release Che Configbump #22

Workflow file for this run

#
# Copyright (c) 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
#
# Contributors:
# Red Hat, Inc. - initial API and implementation
#
name: Release Che Configbump
on:
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'
forceRecreateTags:
description: If true, tags will be recreated. Use with caution
required: false
default: 'false'
env:
IMAGE: quay.io/che-incubator/configbump
jobs:
build-images:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
arch: [amd64,arm64]
outputs:
amd64: ${{ steps.result.outputs.amd64 }}
arm64: ${{ steps.result.outputs.arm64 }}
steps:
-
name: "Checkout Che Dashboard source code"
uses: actions/checkout@v3
-
name: "Set up QEMU"
uses: docker/setup-qemu-action@v2
-
name: "Set up Docker Buildx ${{ matrix.arch }}"
uses: docker/setup-buildx-action@v2
-
name: "Docker quay.io Login"
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
-
name: "Build and push ${{ matrix.arch }}"
uses: docker/build-push-action@v3
with:
context: .
file: ./build/dockerfiles/Dockerfile
platforms: linux/${{ matrix.arch }}
push: true
provenance: false
tags: ${{ env.IMAGE }}:${{ github.event.inputs.version }}-${{ matrix.arch }}
-
id: result
name: "Build result outputs version"
if: ${{ success() }}
run: echo "${{ matrix.arch }}=${{ github.event.inputs.version }}-${{ matrix.arch }}" >> $GITHUB_OUTPUT
create-manifest:
needs: build-images
runs-on: ubuntu-22.04
steps:
-
name: "Docker quay.io Login"
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
-
name: "Create and push manifest"
run: |
AMD64_VERSION="${{ needs['build-images'].outputs.amd64 }}"
ARM64_VERSION="${{ needs['build-images'].outputs.arm64 }}"
if [[ -z "$AMD64_VERSION" || \
-z "$ARM64_VERSION" ]]; then
echo "[!] The job 'build-images' fails on some of the architectures. Can't create complete manifest.";
exit 1;
fi
AMEND=""
AMEND+=" --amend ${{ env.IMAGE }}:$AMD64_VERSION";
AMEND+=" --amend ${{ env.IMAGE }}:$ARM64_VERSION";
docker manifest create ${{ env.IMAGE }}:${{ github.event.inputs.version }} $AMEND
docker manifest push ${{ env.IMAGE }}:${{ github.event.inputs.version }}
-
id: result
name: "Manifest result"
if: ${{ success() }}
run: echo "Manifest was created and pushed successfully"
tag-release:
needs: create-manifest
runs-on: ubuntu-22.04
steps:
-
name: "Checkout source code"
uses: actions/checkout@v3
-
name: Check existing tags
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: "Tag release"
run: |
git config --global user.name "Mykhailo Kuznietsov"
git config --global user.email "[email protected]"
git config --global pull.rebase true
export GITHUB_TOKEN=${{ secrets.CHE_INCUBATOR_BOT_GITHUB_TOKEN }}
/bin/bash make-release.sh --version ${{ github.event.inputs.version }} --tag-release
# - name: Create failure MM message
# if: ${{ failure() }}
# run: |
# echo "{\"text\":\":no_entry_sign: Che Configbump ${{ github.event.inputs.version }} release has failed: https://github.com/che-incubator/configbump/actions/workflows/release.yml\"}" > mattermost.json
# - name: Create success MM message
# run: |
# echo "{\"text\":\":white_check_mark: Che Configbump ${{ github.event.inputs.version }} has been released: quay.io/che-incubator/configbump:${{ 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