Skip to content

chore(ci): notify via slack when a publishing workflow fails #187

chore(ci): notify via slack when a publishing workflow fails

chore(ci): notify via slack when a publishing workflow fails #187

Workflow file for this run

name: Release
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
push:
branches:
- main
env:
HUSKY: 0
concurrency: ${{ github.workflow }}-${{ github.ref }}
permissions:
contents: write
pull-requests: write
jobs:
release:
name: Release
runs-on: [default]
outputs:
# published: ${{ steps.changesets.outputs.published }}
# publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
published: "true"
publishedPackages: '[{"name": "@xx/xx", "version": "1.2.0"}, {"name": "@xx/xy", "version": "0.8.9"}]'
steps:
- name: Checkout Repo
uses: actions/checkout@v4
# - name: Setup Node.js 20.x
# uses: actions/setup-node@v4
# with:
# node-version: 20.x
# - name: Install Dependencies
# run: npm ci
# - name: Create Release Pull Request or Publish to npm
# id: changesets
# uses: changesets/action@v1
# with:
# # This expects you to have a script called release which does a build for your packages and calls changeset publish
# publish: npm run release
# title: "publish(npm): automate Package Versioning and Publishing with Changesets"
# commit: "chore(version): update versions with Changesets"
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
notify-on-success:
if: needs.release.outputs.published == 'true'
needs: [release] # List the jobs that should complete successfully
uses: cloudoperators/juno/.github/workflows/shared-slack-notification.yaml@artie-shared-slack
with:
title: "JUNO Packages Released Successfully! 🚀"
body: ${{ toJson(needs.release.outputs.publishedPackages) }}
rich_body: true
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
notify-on-failure:
if: failure()
needs: [release]
uses: cloudoperators/juno/.github/workflows/shared-slack-notification.yaml@artie-shared-slack
with:
title: "🚨 JUNO Supernova Image Failed 🚨"
body: "An error occurred while building the Supernova image for the branch ${{ github.head_ref || github.ref_name }}. Please check the logs for more information. <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Check the logs>"
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}