This repository has been archived by the owner on Aug 16, 2024. It is now read-only.
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) 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 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@v3 | |
with: | |
node-version: '16' | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@eclipse-che' | |
- | |
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: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: yarn-${{ hashFiles('tools/devworkspace-generator/yarn.lock') }} | |
restore-keys: yarn- | |
- name: publish DevWorkspace Generator | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
run: | | |
cd tools/devworkspace-generator | |
sed -i -r -e "s/(\"version\": )(\".*\")/\1\"${{ github.event.inputs.version }}\"/" package.json | |
yarn | |
yarn compile | |
npm publish --tag latest | |
# che-22407 - mattermost steps are commented out, until we find a replacement for it | |
# - name: Create failure MM message | |
# if: ${{ failure() }} | |
# run: | | |
# echo "{\"text\":\":no_entry_sign: Che Devworkspace Generator ${{ 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 Devworkspace Generator ${{ github.event.inputs.version }} has been released: https://www.npmjs.com/package/@eclipse-che/che-devworkspace-generator/v/${{ 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 |