Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor tweaks to release actions... #2797

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 34 additions & 15 deletions .github/workflows/release-announce.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2019-2022 Red Hat, Inc.
# Copyright (c) 2019-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/
Expand All @@ -16,6 +16,8 @@ on:
push:
tags:
- '7.*.*'
release:
types: [published]
workflow_dispatch:
inputs:
version:
Expand All @@ -25,17 +27,34 @@ jobs:
announce:
runs-on: ubuntu-22.04
steps:
- name: Generate tag utilities
id: TAG_UTIL
run: |
if [[ ${GITHUB_REF#refs/tags/} =~ 7.*.* ]]; then
echo "chectl_version=$(cat VERSION)" >> $GITHUB_OUTPUT
echo "gh_tag=/tag/$(cat VERSION)" >> $GITHUB_OUTPUT
echo "MM_ANNOUNCE=true" >> "$GITHUB_ENV"
elif [[ ${{ github.event.inputs.version }} =~ 7.*.* ]]; then
echo "chectl_version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "gh_tag=/tag/${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "MM_ANNOUNCE=true" >> "$GITHUB_ENV"
else
echo "MM_ANNOUNCE=false" >> "$GITHUB_ENV"
fi
- name: Create success message
run: |
milestone=${{ github.event.inputs.version }}
milestone=${milestone%.*}; echo "milestone: ${milestone}"
echo "{\"text\":\"Che ${{ github.event.inputs.version }} has been released.\n\n Please resolve or move unresolved issues assigned to this milestone: https://github.com/eclipse/che/milestones/${milestone}\"}"
echo "{\"text\":\"Che ${{ github.event.inputs.version }} has been released.\n\n Please resolve or move unresolved issues assigned to this milestone: https://github.com/eclipse/che/milestones/${milestone}\"}" > message.json
- name: Create failure message
if: ${{ failure() }}
run: |
echo "{\"text\":\"Che ${{ github.event.inputs.version }} release final checks have failed:\n\n failed: https://github.com/che-incubator/chectl/actions/workflows/release-announce.yml.\"}"
echo "{\"text\":\"Che ${{ github.event.inputs.version }} release final checks have failed:\n\n failed: https://github.com/che-incubator/chectl/actions/workflows/release-announce.yml.\"}" > message.json

# # SLACK_BOT_TOKEN only works if we have an app, webhook, or other slack integration - https://github.com/slackapi/slack-github-action#how-to-send-data-to-slack
# - name: Send message
# if: ${{ success() }} || ${{ failure() }}
# uses: slackapi/[email protected]
# with:
# channel-id: '@nboldt'
# #channel-id: 'forum-che-release'
# payload-file-path: "./message.json"
# env:
# SLACK_BOT_TOKEN: ${{ secrets.ECLIPSE_CHE_RELEASE_BOT_TOKEN}}
# - name: Ping Productization Team if Failure
# if: ${{ failure() }}
# uses: slackapi/[email protected]
# with:
# channel-id: '@nboldt'
# #channel-id: 'forum-che-release,@sdawley,@mkuznets'
# payload-file-path: "./message.json"
# env:
# SLACK_BOT_TOKEN: ${{ secrets.ECLIPSE_CHE_RELEASE_BOT_TOKEN}}
16 changes: 7 additions & 9 deletions .github/workflows/release-build-and-push-to-GH-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 18.18.0
- name: Generate tag utilities
id: TAG_UTIL
- name: Compute tags and SHAs
id: TAG_SHA
run: |
SHORT_SHA1=$(git rev-parse --short HEAD)
echo "short_sha1=$SHORT_SHA1" >> $GITHUB_OUTPUT
Expand All @@ -40,13 +40,11 @@ jobs:
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
Expand All @@ -56,22 +54,22 @@ jobs:
run: |
git config --local user.name ${{ github.actor }}

sed -i "0,/\"version\":\ \"\(.*\)\",/s/\"version\":\ \"\(.*\)\",/\"version\":\ \"${{ steps.TAG_UTIL.outputs.chectl_version }}\",/" package.json
sed -i "0,/\"version\":\ \"\(.*\)\",/s/\"version\":\ \"\(.*\)\",/\"version\":\ \"${{ steps.TAG_SHA.outputs.chectl_version }}\",/" 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 }}
git tag ${{ steps.TAG_SHA.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 }}/}"
mv "$file" "${file/-v${{ steps.TAG_SHA.outputs.chectl_version }}-${{ steps.TAG_SHA.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 }}
name: ${{ steps.TAG_SHA.outputs.gh_release_name }}
tag_name: ${{ steps.TAG_SHA.outputs.gh_tag }}
files: "./dist/chectl-*.gz"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading