Release - Send mattermost notification #86
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
# This Workflow announces a release in Eclipse Mattermost to https://mattermost.eclipse.org/eclipse/channels/eclipse-che-releases | |
name: Release - Send mattermost notification | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version that is going to be announced. Should be in format 7.y.z' | |
required: true | |
default: '' | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Verify branches | |
id: check | |
run: | | |
BRANCH=${{ github.event.inputs.version }} | |
BRANCH=${BRANCH%.*}.x | |
SCRIPT_OUTPUT=$(./utils/check-branches.sh "${BRANCH}") | |
if [[ "${SCRIPT_OUTPUT}" == *"[ERROR]"* ]]; then | |
#TODO find a working solution to output multiline text in the next step | |
exit 1 | |
fi | |
- name: Create success message | |
run: | | |
milestone=${{ github.event.inputs.version }} | |
milestone=${milestone%.*}; echo "milestone: ${milestone}" | |
echo "{\"text\":\":che-logo: 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}\"}" > mattermost.json | |
- name: Create failure message | |
if: ${{ failure() }} | |
run: | | |
echo "{\"text\":\":che-logo: Che ${{ github.event.inputs.version }} release final checks have failed:\n\n failed: https://github.com/eclipse-che/che-release/actions/workflows/release-send-mattermost-announcement.yml.\"}" > mattermost.json | |
- name: Send 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 |