Skip to content
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
32 changes: 29 additions & 3 deletions .github/workflows/notify-consumers-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,48 @@ name: Notify consumers on contract release
on:
release:
types: [published]
workflow_dispatch:
inputs:
test_tag:
description: "Simulated release tag for test runs (for example: v2.1.4)"
required: true
type: string
dry_run:
description: "When true, do not dispatch to consumer repos; log only"
required: false
type: boolean
default: true

jobs:
notify-consumers:
runs-on: ubuntu-latest
env:
TAG: ${{ github.event.release.tag_name || inputs.test_tag }}
strategy:
fail-fast: false
matrix:
consumer:
- owner: chaithubk
repo: medtech-vitals-publisher
steps:
- name: Validate tag input
run: |
if [ -z "$TAG" ]; then
echo "::error::Tag is empty. Provide workflow_dispatch input 'test_tag' or run on release event."
exit 1
fi

- name: Dry run notice
if: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run }}
run: |
echo "::warning::Dry run enabled. No consumer dispatches will be sent."

- name: Dispatch contract-release-published to ${{ matrix.consumer.owner }}/${{ matrix.consumer.repo }}
if: ${{ github.event_name != 'workflow_dispatch' || !inputs.dry_run }}
env:
GH_TOKEN: ${{ secrets.CONSUMER_DISPATCH_TOKEN }}
CONSUMER_OWNER: ${{ matrix.consumer.owner }}
CONSUMER_REPO: ${{ matrix.consumer.repo }}
TAG: ${{ github.event.release.tag_name }}
run: |
echo "Notifying $CONSUMER_OWNER/$CONSUMER_REPO of release $TAG"
gh api repos/$CONSUMER_OWNER/$CONSUMER_REPO/dispatches \
Expand All @@ -31,5 +56,6 @@ jobs:
- name: Log dispatch result
if: always()
run: |
echo "Release tag: ${{ github.event.release.tag_name }}"
echo "Release URL: ${{ github.event.release.html_url }}"
echo "Event name: ${{ github.event_name }}"
echo "Release tag: $TAG"
echo "Release URL: ${{ github.event.release.html_url || 'n/a (workflow_dispatch)' }}"
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
actions: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -53,6 +54,17 @@ jobs:
run: |
echo "::warning::Running in test_mode=true. Governance checks, tag creation, and GitHub release steps are skipped."

- name: Trigger notify workflow (test mode)
if: ${{ inputs.test_mode }}
env:
GH_TOKEN: ${{ github.token }}
run: |
gh workflow run notify-consumers-on-release.yml \
--ref "${{ github.ref_name }}" \
-f test_tag="${{ steps.read_version.outputs.tag }}" \
-f dry_run=false
echo "Triggered notify-consumers-on-release.yml with real dispatch for tag ${{ steps.read_version.outputs.tag }}"

- name: Build release notes from changelog
run: |
python3 scripts/extract_release_notes.py --version "${{ steps.read_version.outputs.version }}" --output release-notes.md
Expand Down
Loading