Skip to content
Merged
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
87 changes: 87 additions & 0 deletions .github/workflows/update-c2pa-core-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
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, keep v prefix as used in gradle.properties)
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 gradle.properties
id: current_version
run: |
CURRENT_VERSION=$(grep '^c2paVersion=' library/gradle.properties | 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 gradle.properties
if: steps.check_update.outputs.needs_update == 'true'
run: |
# Update the c2paVersion in library/gradle.properties
sed -i "s/^c2paVersion=.*/c2paVersion=${{ steps.get_release.outputs.version }}/" library/gradle.properties

# Verify the changes
echo "Updated library/gradle.properties:"
grep '^c2paVersion=' library/gradle.properties

- 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 c2paVersion in library/gradle.properties 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