ci: add new release version alert #5
Workflow file for this run
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
name: Release Version Alert | |
on: | |
pull_request: | |
branches: [ main ] | |
jobs: | |
check-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Check versions | |
id: check-versions | |
run: | | |
if [[ "$(bash scripts/check-new-release-version.sh)" == "Found new non-dev version"* ]]; then | |
echo "Sending Slack notification..." | |
MESSAGE="Current version $CURRENT_VERSION does not match the version in the main branch ($MAIN_VERSION). :rocket:" | |
echo "::set-output name=message::$MESSAGE" # Set an output variable to pass the message to the next step | |
else | |
echo "No new non-dev version found. Skipping Slack notification." | |
echo "::set-output name=message::" # Set an empty output variable to ensure no message is passed to the next step | |
- name: Slack Notification | |
if: steps.check-versions.outputs.message != '' | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_BOT_TOKEN }} | |
SLACK_CHANNEL: gh-new-version-alert | |
SLACK_MESSAGE: ${{ steps.check-versions.outputs.message }} |