Add outputs and notification step to workflow

This update extracts the Conan package version as an output and adds a step to notify a dependent repository of changes.

NP-732
This commit is contained in:
saumyaj3 2025-02-11 10:32:25 +01:00
parent 23cb08ed4f
commit bdaeb1e820

View File

@ -29,3 +29,32 @@ jobs:
platform_mac: false
install_system_dependencies: false
secrets: inherit
outputs:
package_version: ${{ steps.get-package-version.outputs.package_version }}
steps:
- name: Extract Conan Package Version
id: get-package-version
run: |
# Replace this with your real logic to determine the package version
PACKAGE_VERSION=$(cat ./resources/conanfile.py | grep version | head -n 1 | cut -d '"' -f 2)
echo "Detected package version: $PACKAGE_VERSION"
echo "package_version=$PACKAGE_VERSION" >> $GITHUB_ENV
# Set the package_version as an output
echo "::set-output name=package_version::$PACKAGE_VERSION"
notify-dependent-package:
runs-on: ubuntu-latest
needs: conan-package # Ensures this job runs after conan-package completes!
steps:
- name: Notify Dependent Repository
env:
GITHUB_TOKEN: ${{ secrets.DEPENDENT_REPO_TOKEN }} # Ensure token has correct scopes
run: |
curl -X POST -H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/DEPENDENT_ORG/DEPENDENT_REPO/dispatches \
-d '{"event_type": "dependency-package-change", "client_payload": { "changed_dependency": "dependency-package", "version": "{{ needs.conan-package.outputs.package_version }}" }}'