Repository navigation
75 lines (74 loc) · 2.89 KB
/
Copy pathrelease.yml
File metadata and controls
75 lines (74 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#
# 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@11d5960a326750d5838078e36cf38b85af677262 # v4
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 Python 3.12
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: 3.12
- name: Set up yq
run: |
python -m pip install --upgrade pip
pip install yq
- name: Set up QEMU
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- name: Login to quay.io
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3
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 "mkuznets@redhat.com"
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 }} .