Update C2PA core SDK version #783
This file contains hidden or 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: Update C2PA core SDK version | |
| on: | |
| schedule: | |
| # Check for new releases every 6 hours | |
| - cron: "0 */6 * * *" | |
| workflow_dispatch: | |
| jobs: | |
| check-and-update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Get latest c2pa-rs release | |
| id: get_release | |
| run: | | |
| # Get the latest release tag from c2pa-rs that matches the pattern c2pa-c-ffi-v* | |
| LATEST_TAG=$(curl -s "https://api.github.com/repos/contentauth/c2pa-rs/releases" | \ | |
| jq -r '.[].tag_name | select(test("^c2pa-c-ffi-v"))' | \ | |
| head -1) | |
| if [ -z "$LATEST_TAG" ]; then | |
| echo "No matching tags found" | |
| exit 1 | |
| fi | |
| # Extract version from the tag (remove c2pa-c-ffi- prefix) | |
| VERSION=$(echo "$LATEST_TAG" | sed 's/^c2pa-c-ffi-//') | |
| echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Latest matching tag: $LATEST_TAG" | |
| echo "Extracted version: $VERSION" | |
| - name: Get current version from Base.xcconfig | |
| id: current_version | |
| run: | | |
| CURRENT_VERSION=$(grep '^C2PA_VERSION' Configurations/Base.xcconfig | cut -d'=' -f2 | xargs) | |
| echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
| echo "Current version: $CURRENT_VERSION" | |
| - name: Check if update is needed | |
| id: check_update | |
| run: | | |
| if [ "${{ steps.get_release.outputs.version }}" != "${{ steps.current_version.outputs.current_version }}" ]; then | |
| echo "needs_update=true" >> $GITHUB_OUTPUT | |
| echo "Update needed: ${{ steps.current_version.outputs.current_version }} -> ${{ steps.get_release.outputs.version }}" | |
| else | |
| echo "needs_update=false" >> $GITHUB_OUTPUT | |
| echo "No update needed, versions match: ${{ steps.current_version.outputs.current_version }}" | |
| fi | |
| - name: Update Base.xcconfig and CI workflow | |
| if: steps.check_update.outputs.needs_update == 'true' | |
| run: | | |
| # Update the C2PA_VERSION in Base.xcconfig | |
| sed -i "s/^C2PA_VERSION = .*/C2PA_VERSION = ${{ steps.get_release.outputs.version }}/" Configurations/Base.xcconfig | |
| # Verify the changes | |
| echo "Updated Base.xcconfig:" | |
| grep '^C2PA_VERSION' Configurations/Base.xcconfig | |
| - name: Create pull request | |
| if: steps.check_update.outputs.needs_update == 'true' | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "Update core C2PA SDK to ${{ steps.get_release.outputs.version }}" | |
| title: "Update core C2PA SDK to ${{ steps.get_release.outputs.version }}" | |
| body: | | |
| This PR updates C2PA_VERSION in Base.xcconfig and test workflow to use the latest c2pa-rs release. | |
| - **Previous version**: ${{ steps.current_version.outputs.current_version }} | |
| - **New version**: ${{ steps.get_release.outputs.version }} | |
| - **Release tag**: ${{ steps.get_release.outputs.latest_tag }} | |
| This update was automatically generated by the update-c2pa-core-sdk workflow. | |
| Please review and merge if the changes look correct. | |
| branch: update-c2pa-version-${{ steps.get_release.outputs.version }} | |
| delete-branch: true |