Skip to content
Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Latest commit

 

History

89 Commits

Folders and files

Repository files navigation

WP Release Checksums

GitHub Marketplace Latest release npm

GitHub Action that writes a checksums manifest of a WordPress plugin or theme using @wpelevator/wp-release. It's named after the wp-release checksums command that it runs.

By default, the manifest lists the MD5 and SHA-256 hash of every distributed file in the format of the WordPress.org plugin checksums API, with paths relative to the plugin or theme folder. Because it lists the files and not the ZIP, it stays valid for the GitHub release ZIP, the ZIP that WordPress.org builds from SVN and an installed copy. To get one together with the ZIP, use the checksums input of wp-release-zip instead, so that both select the same files. wp-release-sign signs the manifest so that it can be trusted.

Usage

Use true or false for boolean inputs; the action validates these values before running the command.

These actions require a runner with the Node.js 24 action runtime. Keep self-hosted runners updated before using them.

Pin uses: to the latest released version from the releases page. Upgrades are intentionally manual: floating major or minor tags are not published.

jobs:
  checksums:
    runs-on: ubuntu-24.04
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v7

      - id: checksums
        uses: wpelevator/wp-release-checksums@0.4.0
        with:
          source-dir: dist

Manifest inside the plugin

To ship the signed manifest inside the plugin, so that an installed copy can be verified later, write it into the directory that is zipped and deployed, sign it, and then zip and deploy that directory:

      - uses: wpelevator/wp-release-checksums@0.4.0
        with:
          source-dir: dist
          output: dist/checksums.json

      - uses: wpelevator/wp-release-sign@0.3.1
        with:
          files: dist/checksums.json
          signing-key: ${{ secrets.WP_RELEASE_SIGNING_KEY }}

      - uses: wpelevator/wp-release-zip@0.6.0
        with:
          source-dir: dist # Without the checksums input, which would write a second manifest.

The manifest doesn't list itself or its .sig, and output can be any path inside source-dir, such as dist/includes/checksums.json; missing folders are created. Attach the two files to the release as well. See Manifest inside the plugin for the post-deploy check against WordPress.org.

These checksum and signing steps need only contents: read for checkout; signing uses the supplied secret. Set this permission on jobs using the step examples in this README.

GNU and custom manifest formats

The checksums-format: sha256sum input writes GNU-compatible SHA-256 lines and defaults to SHA256SUMS; output still selects an explicit path relative to the repository root. config selects a trusted release config containing integrity.codec, including custom codecs; checksums-format overrides that codec. The standalone command does not apply integrity.file, embedding, signing or algorithm selection: use the ZIP action for those options and the sign action for standalone signatures.

Inputs

Input Default Description
source-dir . Directory to hash.
config conventional config in the repository root Trusted JavaScript config path for integrity.codec.
checksums-format integrity.codec, else wordpress-json wordpress-json or sha256sum; GNU output defaults to SHA256SUMS instead of the JSON filename.
slug repository name Plugin or theme slug.
version Version header Version for the manifest and its filename.
filename-format {slug}.{version} JSON filename with {slug} and {version}, followed by .checksums.json; other codecs use their default filename unless output is supplied.
output the filename in the repository root Path of the manifest.
distignore .distignore in source-dir when present Path to the ignore file, or false to not read one.
exclude Extra gitignore-style patterns separated by commas or new lines, like build/,assets/*,images/**/*. They're applied after the ignore file, so a ! pattern can re-include a file.
exclude-gitattributes false Also exclude paths marked export-ignore by Git attributes. Requires source-dir to be inside a Git repository.
type detected from the headers, else plugin plugin or theme.
force false Overwrite an existing manifest.

Outputs

Output Description
checksums-path Absolute path of the checksums manifest.
files Number of hashed files.

Job summary

Each run adds a section to the job summary of the run with the manifest and its number of files. A failed run adds its error instead, and the run fails. The paths are relative to the workspace.

Without the action

When you can't use a GitHub Action, such as on another CI system or in a local release script, add the same tooling as a development dependency and run the CLI command that the action runs:

npm install --save-dev @wpelevator/wp-release
npx wp-release checksums dist

The inputs map to the flags of wp-release checksums: source-dir is the first argument, config, checksums-format, slug, version, type, filename-format, output, distignore, exclude, exclude-gitattributes and force keep their names, and distignore: false is --no-distignore. Add --json to read the path of the manifest from the output. The CLI needs Node.js 22.12 or later, and has no other dependencies on the runner. Run npx wp-release checksums --help for all options.

How it works

src/run.ts reads the inputs with @actions/core, maps them to the arguments of the wp-release checksums command and runs it through the execute() function of @wpelevator/wp-release, so the action and the CLI always behave the same. The action runs dist/index.js, a single file bundled with esbuild that includes wp-release and all other dependencies, so nothing is installed from npm when the action runs. The tooling version is fixed by the action ref you pin.

Development

The source is TypeScript in src/. dist/ is git-ignored in the monorepo. npm run build bundles the @wpelevator/wp-release dependency at the version that the action's package.json pins. The dependents policy of the monorepo release configuration re-releases the actions whenever a later version falls outside their pins and rewrites them, so they don't need a manual update. A pin that drifts from the published version, like a deliberate pin to an older release, selects a registry install instead, and changeset status warns until the pin resolves the package again. The split-push workflow commits the bundle to the action's release repository. npm test runs the input mapping and action execution tests with Node.js type stripping, and npm run lint runs ESLint and a tsc type check.

npm run build --workspace @wpelevator/wp-release-checksums-action

Releases

Packages

Contributors

Languages