diff --git a/.github/workflows/c2patool-release.yml b/.github/workflows/c2patool-release.yml index 38850216..9f586e4f 100644 --- a/.github/workflows/c2patool-release.yml +++ b/.github/workflows/c2patool-release.yml @@ -74,6 +74,48 @@ jobs: cp "target/${{ matrix.artifact_name }}" "dist/${{ matrix.asset_name }}" cp "c2patool-sbom.json" "dist/${{ matrix.sbom_asset_name }}" + # Chocolatey/.deb/.rpm packages are additional download options for the + # same release, not separate artifact_name/asset_name/sbom_asset_name + # matrix entries -- their filenames come from the packaging tools + # themselves (nuspec/deb/rpm metadata) rather than a fixed name, so + # they're just dropped into dist/ and picked up by the `release` job's + # `files: dist/*` glob like everything else. + - name: Build Chocolatey package + if: matrix.os == 'windows-latest' + shell: pwsh + run: | + $tag = '${{ github.ref_name }}' + # NuGet/Chocolatey must be bare SemVer -- no leading "v". + $version = $tag -replace '^v', '' + $checksum = (Get-FileHash target\c2patool_win_intel.zip -Algorithm SHA256).Hash.ToLower() + + Copy-Item -Recurse chocolatey chocolatey-pkg + + (Get-Content chocolatey-pkg\c2patool.nuspec) ` + -replace '__VERSION__', $version | + Set-Content chocolatey-pkg\c2patool.nuspec + + (Get-Content chocolatey-pkg\tools\chocolateyInstall.ps1) ` + -replace '__TAG__', $tag ` + -replace '__CHECKSUM__', $checksum | + Set-Content chocolatey-pkg\tools\chocolateyInstall.ps1 + + choco pack chocolatey-pkg\c2patool.nuspec --outputdirectory dist + + - name: Build .deb package + if: matrix.os == 'ubuntu-latest' + run: | + cargo install cargo-deb + cargo deb --no-build + cp target/debian/*.deb dist/ + + - name: Build .rpm package + if: matrix.os == 'ubuntu-latest' + run: | + cargo install cargo-generate-rpm + cargo generate-rpm + cp target/generate-rpm/*.rpm dist/ + - name: Upload build artifacts uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: diff --git a/Cargo.toml b/Cargo.toml index a91f961c..1f1b890b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -85,6 +85,27 @@ c2pa = { git = "https://github.com/contentauth/c2pa-rs", branch = "main", defaul wasi = "0.14" wstd = "0.5" +[package.metadata.deb] +maintainer = "CAI Open Source " +copyright = "2026 Adobe. All rights reserved." +license-file = ["LICENSE-MIT", "4"] +extended-description = """\ + c2patool is a command line tool for working with C2PA manifests \ + and media asset provenance.""" +depends = "$auto" +section = "utils" +priority = "optional" +assets = [ + ["target/release/c2patool", "usr/bin/", "755"], + ["README.md", "usr/share/doc/c2patool/README.md", "644"], +] + +[package.metadata.generate-rpm] +assets = [ + { source = "target/release/c2patool", dest = "/usr/bin/c2patool", mode = "0755" }, + { source = "README.md", dest = "/usr/share/doc/c2patool/README.md", mode = "0644", doc = true }, +] + [package.metadata.cargo-udeps.ignore] development = ["mockall"] diff --git a/README.md b/README.md index 07c45266..be1f5043 100644 --- a/README.md +++ b/README.md @@ -29,15 +29,51 @@ For a simple example of calling c2patool from a Node.js server application, see ## Installation -If you are using macOS, you can install C2PA Tool using Homebrew: +### Homebrew (macOS and Linux) + +You can install C2PA Tool using [Homebrew](https://brew.sh/): 1. Install [Homebrew](https://brew.sh/) if you haven't already done so. -1. Install C2PA Tool: +2. Install C2PA Tool: ``` brew install c2patool ``` -If you're using another OS or don't want to use Homebrew, install a prebuilt binary of C2PA Tool: +### Windows package installation + +On Windows, you can install c2patool using [Chocolatey](https://chocolatey.org/): + +1. Install [Chocolatey](https://chocolatey.org/install) if you haven't already done so. +2. Go to the [Releases page](https://github.com/contentauth/c2patool/releases). +3. Under **Assets**, download the `.nupkg` file (for example, `c2patool.x.y.z.nupkg`). +4. Install it: + ``` + choco install c2patool --source ".;chocolatey" + ``` + +### Linux package installation + +On Debian/Ubuntu-based systems, you can install the `.deb` package: + +1. Go to the [Releases page](https://github.com/contentauth/c2patool/releases). +2. Under **Assets**, download the `.deb` file (for example, `c2patool_x.y.z-1_amd64.deb`). +3. Install it: + ``` + sudo dpkg -i c2patool_*.deb + ``` + +On Fedora/RHEL/Rocky Linux-based systems, you can install the `.rpm` package: + +1. Go to the [Releases page](https://github.com/contentauth/c2patool/releases). +2. Under **Assets**, download the `.rpm` file (for example, `c2patool-x.y.z-1.x86_64.rpm`). +3. Install it: + ``` + sudo rpm -i c2patool-*.rpm + ``` + +### Other platforms + +If you don't want to use a package manager, install a prebuilt binary of C2PA Tool: 1. Go to the [Releases page](https://github.com/contentauth/c2patool/releases). 2. Under **Assets**, click on the archive file for your operating system: diff --git a/chocolatey/c2patool.nuspec b/chocolatey/c2patool.nuspec new file mode 100644 index 00000000..ecbf9eb3 --- /dev/null +++ b/chocolatey/c2patool.nuspec @@ -0,0 +1,25 @@ + + + + c2patool + __VERSION__ + c2patool + Adobe Content Authenticity Initiative + Adobe Content Authenticity Initiative + https://contentauthenticity.org + https://github.com/contentauth/c2patool/blob/main/LICENSE-MIT + false + c2patool is a command line tool for working with C2PA manifests and media asset provenance. + +Use it to read a summary JSON report of C2PA manifests, inspect low-level manifest data, or add a C2PA manifest to a media file. + Command line tool for working with C2PA manifests and media asset provenance. + c2pa xmp metadata content-authenticity provenance cli commandline + https://opensource.contentauthenticity.org/docs/c2patool + https://github.com/contentauth/c2patool/issues + https://github.com/contentauth/c2patool/tree/main/chocolatey + https://github.com/contentauth/c2patool/blob/main/CHANGELOG.md + + + + + diff --git a/chocolatey/tools/chocolateyInstall.ps1 b/chocolatey/tools/chocolateyInstall.ps1 new file mode 100644 index 00000000..8f792f63 --- /dev/null +++ b/chocolatey/tools/chocolateyInstall.ps1 @@ -0,0 +1,15 @@ +$ErrorActionPreference = 'Stop' + +$tag = '__TAG__' +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" + +$packageArgs = @{ + packageName = 'c2patool' + unzipLocation = $toolsDir + fileType = 'zip' + url64bit = "https://github.com/contentauth/c2patool/releases/download/${tag}/${tag}-x86_64-pc-windows-msvc.zip" + checksum64 = '__CHECKSUM__' + checksumType64 = 'sha256' +} + +Install-ChocolateyZipPackage @packageArgs