Release Che Devworkspace Generator #6
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) 2022-2024 | |
# 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 Devworkspace Generator | |
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' | |
jobs: | |
build: | |
name: Create Che Devfile Registry Release | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@eclipse-che' | |
- name: "Checkout source code" | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up environment | |
run: | | |
sudo apt-get update -y || true | |
sudo apt-get -y -q install hub | |
hub --version | |
- name: Install NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.18.0 | |
- 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: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: | | |
echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
id: yarn-cache | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: yarn-${{ hashFiles('yarn.lock') }} | |
restore-keys: yarn- | |
- name: Run make-release.sh script | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
GITHUB_TOKEN: ${{secrets.DEVWORKSPACE_GENERATOR_RELEASE_GITHUB_TOKEN}} | |
run: | | |
git config --global user.name "Anatolii Bazko" | |
git config --global user.email "[email protected]" | |
./make-release.sh --version ${{ github.event.inputs.version }} | |