Add extract-package-version job to workflow

NP-732
This commit is contained in:
saumyaj3 2025-02-11 10:40:33 +01:00
parent 26eb14bac1
commit 7fb47466ed

View File

@ -30,6 +30,9 @@ jobs:
install_system_dependencies: false
secrets: inherit
extract-package-version:
runs-on: ubuntu-latest
needs: conan-package
outputs:
package_version: ${{ steps.get-package-version.outputs.package_version }}
@ -40,21 +43,21 @@ jobs:
# Replace this with your real logic to determine the package version
PACKAGE_VERSION=$(cat ./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
# Set the package_version as an output for this job
echo "::set-output name=package_version::$PACKAGE_VERSION"
# Job 3: Notify the dependent repository
notify-dependent-package:
runs-on: ubuntu-latest
needs: conan-package # Ensures this job runs after conan-package completes!
needs: extract-package-version # This ensures that it runs after extract-package-version
steps:
- name: Notify Dependent Repository
env:
GITHUB_TOKEN: ${{ secrets.DEPENDENT_REPO_TOKEN }} # Ensure token has correct scopes
GITHUB_TOKEN: ${{ secrets.DEPENDENT_REPO_TOKEN }}
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 }}" }}'
-d '{"event_type": "dependency-package-change", "client_payload": { "changed_dependency": "dependency-package", "version": "${{ needs.extract-package-version.outputs.package_version }}" }}'