Skip to content

Release Che Dashboard #126

Release Che Dashboard

Release Che Dashboard #126

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 Dashboard
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/eclipse/che-dashboard
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 Che Dashboard source code"
uses: actions/checkout@v3
-
name: "Setup Node"
uses: actions/setup-node@v3
with:
node-version: "18"
-
name: "Install npm & lerna"
run: "npm install --global lerna"
-
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 "mkuznets@redhat.com"
git config --global pull.rebase true
export GITHUB_TOKEN=${{ secrets.CHE_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 Dashboard ${{ github.event.inputs.version }} release has failed: https://github.com/eclipse/che-dashboard/actions/workflows/release.yml\"}" > mattermost.json
#- name: Create success MM message
#run: |
#echo "{\"text\":\":white_check_mark: Che Dashboard ${{ github.event.inputs.version }} has been released: https://quay.io/eclipse/che-dashboard:${{ github.event.inputs.version }}\"}" > mattermost.json
#- name: Send MM message
#if: ${{ success() }} || ${{ failure() }}
#uses: mattermost/action-mattermost-notify@1.1.0
#env:
#MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
#MATTERMOST_CHANNEL: eclipse-che-releases
#MATTERMOST_USERNAME: che-bot