Skip to content

chore(deps): Bump @oclif/plugin-help from 5.2.0 to 5.2.20 (#2775) #868

chore(deps): Bump @oclif/plugin-help from 5.2.0 to 5.2.20 (#2775)

chore(deps): Bump @oclif/plugin-help from 5.2.0 to 5.2.20 (#2775) #868

#
# 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: 18.16.1
- name: Generate tag utilities
id: TAG_UTIL
run: |
SHORT_SHA1=$(git rev-parse --short HEAD)
echo "short_sha1=$SHORT_SHA1" >> $GITHUB_OUTPUT
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')
echo "gh_tag=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
echo "chectl_version=0.0.$CURRENT_DAY-next.$SHORT_SHA1" >> $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
yarn prepack && yarn pack-binaries --targets=$TARGETS
# Rename binaries to remove the sha1 from their names
for file in ./dist/*; do
mv "$file" "${file/-v${{ steps.TAG_UTIL.outputs.chectl_version }}-${{ steps.TAG_UTIL.outputs.short_sha1 }}/}"
done
- 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/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