chore(release): release version 7.73.0 (#2729) #841
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) 2019-2022 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 - generate release and push artifacts to github pages (after PR approved) | |
on: | |
# Trigger the workflow on push only for the main and 7.y.x branches | |
push: | |
branches: | |
- '7.*.x' | |
- 'main' | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Install NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.13 | |
- name: Generate tag utilities | |
id: TAG_UTIL | |
run: | | |
if [[ ${GITHUB_REF#refs/heads/} =~ 7.* ]]; then | |
echo "chectl_version=$(cat VERSION)" >> $GITHUB_OUTPUT | |
echo "gh_release_name=$(cat VERSION)" >> $GITHUB_OUTPUT | |
echo "gh_tag=$(cat VERSION)" >> $GITHUB_OUTPUT | |
echo "MM_ANNOUNCE=true" >> "$GITHUB_ENV" | |
elif [[ ${GITHUB_REF#refs/heads/} =~ main ]]; then | |
CURRENT_DAY=$(date +'%Y%m%d') | |
SHORT_SHA1=$(git rev-parse --short HEAD) | |
echo "gh_tag=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT | |
echo "chectl_version=0.0.$CURRENT_DAY-next" >> $GITHUB_OUTPUT | |
echo "gh_release_name=0.0.$CURRENT_DAY-next.$SHORT_SHA1" >> $GITHUB_OUTPUT | |
echo "MM_ANNOUNCE=false" >> "$GITHUB_ENV" | |
fi | |
- name: Build chectl | |
run: yarn | |
- name: Run unit tests | |
run: yarn test | |
- name: Pack chectl | |
run: | | |
git config --local user.name ${{ github.actor }} | |
sed -i "s#version\":\ \"\(.*\)\",#version\":\ \"${{ steps.TAG_UTIL.outputs.chectl_version }}\",#g" package.json | |
sed -i "s|INSERT-KEY-HERE|${{ secrets.SEGMENT_WRITE_KEY }}|g" src/hooks/analytics/analytics.ts | |
git tag ${{ steps.TAG_UTIL.outputs.gh_tag }} | |
TARGETS=linux-arm,linux-x64,linux-s390x,linux-ppc64le,darwin-x64,darwin-arm64,win32-x64,win32-x86 | |
npx oclif-dev pack --targets=$TARGETS | |
- name: Create Release and push artifacts | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ steps.TAG_UTIL.outputs.gh_release_name }} | |
tag_name: ${{ steps.TAG_UTIL.outputs.gh_tag }} | |
files: "./dist/channels/**/chectl-*.gz" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Update github pages | |
run: | | |
git clone https://github.com/che-incubator/chectl -b gh-pages --single-branch gh-pages | |
rm -rf gh-pages/.git | |
echo $(date +%s) > gh-pages/update | |
env | |
- name: Deploy to github pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH: gh-pages | |
FOLDER: gh-pages | |
CLEAN: true # Automatically remove deleted files from the deploy branch | |
- name: Create success MM message | |
run: | | |
echo "{\"text\":\":white_check_mark: Chectl ${{ steps.TAG_UTIL.outputs.chectl_version }} released: https://github.com/che-incubator/chectl/releases${{ steps.TAG_UTIL.outputs.gh_tag }}\"}" > mattermost.json | |
- name: Create failure message | |
if: ${{ failure() }} | |
run: | | |
echo "{\"text\":\":che-logo: Problem with chectl ${{ steps.TAG_UTIL.outputs.chectl_version }} release.\n\n \"}" > mattermost.json | |
- name: Send MM message | |
if: ${{ env.MM_ANNOUNCE == 'true' }} | |
uses: mattermost/action-mattermost-notify@1.0.2 | |
env: | |
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }} | |
MATTERMOST_CHANNEL: eclipse-che-releases | |
MATTERMOST_USERNAME: che-bot |