Open source plugin for Wordpress to present the latest release from a Github compliant source control server.
  • PHP 87.9%
  • Shell 8.8%
  • CSS 3.2%
  • JavaScript 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Gwen Gullett 6e668c0022
All checks were successful
CI / commitlint (push) Successful in 39s
CI / package (push) Successful in 11s
Release / Release (push) Successful in 48s
Release / Release Summary (push) Has been skipped
test: more unittests
2026-07-26 19:35:05 -04:00
.forgejo fix: another ci tweak 2026-07-26 15:32:47 -04:00
assets/css feat: created new plugin 2026-07-26 14:17:24 -04:00
bin feat: correctly set license and fix ci upload 2026-07-26 15:56:20 -04:00
includes feat: add a button to clear cache 2026-07-26 19:12:28 -04:00
tests test: more unittests 2026-07-26 19:35:05 -04:00
.gitignore feat: created new plugin 2026-07-26 14:17:24 -04:00
.releaserc.json fix: another asset tweak 2026-07-26 16:05:11 -04:00
CHANGELOG.md chore(release): 1.1.0 [skip ci] 2026-07-26 23:14:14 +00:00
commitlint.config.cjs feat: created new plugin 2026-07-26 14:17:24 -04:00
composer.json feat: correctly set license and fix ci upload 2026-07-26 15:56:20 -04:00
composer.lock feat: created new plugin 2026-07-26 14:17:24 -04:00
LICENSE feat: correctly set license and fix ci upload 2026-07-26 15:56:20 -04:00
package-lock.json feat: created new plugin 2026-07-26 14:17:24 -04:00
package.json feat: created new plugin 2026-07-26 14:17:24 -04:00
phpunit.xml.dist feat: created new plugin 2026-07-26 14:17:24 -04:00
README.md feat: correctly set license and fix ci upload 2026-07-26 15:56:20 -04:00
wp-git-releases.php chore(release): 1.1.0 [skip ci] 2026-07-26 23:14:14 +00:00

WP Git Releases

WP Git Releases is a WordPress plugin that shows the latest release for a GitHub-compatible repository (GitHub, Gitea, or Forgejo).

It includes:

  • An admin settings page
  • A shortcode
  • A widget
  • Optional release notes body rendering from Markdown

Installation

  1. Copy this plugin folder into your WordPress plugins directory.
  2. Activate WP Git Releases from the WordPress admin.
  3. Open Settings -> WP Git Releases.
  4. Configure:
    • Server Domain (example: github.com, codeberg.org, git.example.com)
    • Project Owner
    • Project Repository

Settings

  • Server Domain: Domain for your Git server
  • Project Owner: Repository owner or organization
  • Project Repository: Repository name
  • API Token (optional): Token for private repos or higher API limits
  • Show Release Notes By Default: Controls whether release body is shown
  • Cache Duration (minutes): API response cache duration using transients
  • Debug Mode: Shows generated release API URL candidates and response diagnostics to administrators

Shortcode

Use the shortcode:

[git_release]

Optional attributes:

  • show_body="1" or "0"
  • show_assets="1" or "0"
  • max_assets="0" for all, or any positive integer
  • title="Your title"

Example:

[git_release show_body="1" show_assets="1" max_assets="5" title="Latest Download"]

Widget

Use the widget named:

WP Git Releases: Latest Release

Widget options:

  • Title
  • Show download assets
  • Show release notes (Markdown)
  • Max assets to display

API behavior

The plugin attempts these latest-release endpoints:

If an API token is configured, requests include:

  • Authorization: Bearer {token}
  • X-API-Token: {token}

Frontend styles

The plugin loads a frontend stylesheet for shortcode and widget output:

  • assets/css/wgr-frontend.css

Testing

This repository includes WordPress PHPUnit scaffolding and integration tests.

  1. Install dev dependencies:

composer install

  1. Install WordPress test suite files:

bash bin/install-wp-tests.sh wordpress_test root '' localhost latest

  1. Run tests:

WP_TESTS_DIR=/tmp/wordpress-tests-lib vendor/bin/phpunit

Included tests:

  • tests/test-plugin-load.php
  • tests/test-release-render.php

Packaging for WordPress

Build a distributable plugin zip:

composer package

This creates a zip in dist/ named like:

  • wp-git-releases-1.0.0.zip

The archive includes only the files WordPress needs to load the plugin:

  • wp-git-releases.php
  • includes/
  • assets/
  • README.md (if present)
  • LICENSE (if present)

Conventional Commits

This project uses Conventional Commits and enforces them in CI.

Examples:

  • feat: add support for repository tokens
  • fix: sanitize release body output
  • docs: clarify shortcode options
  • chore: update release workflow

The commit header format is:

type(scope): short summary

Scope is optional. Common types are feat, fix, docs, chore, refactor, test, and ci.

Automated Releases (Forgejo + semantic-release)

Releases are generated by Forgejo Actions using semantic-release with:

  • semantic versioning based on Conventional Commits
  • automatic changelog updates (CHANGELOG.md)
  • automatic plugin version updates in wp-git-releases.php
  • automatic plugin zip creation and upload as a Forgejo release asset

Workflow files:

  • .forgejo/workflows/ci.yml
  • .forgejo/workflows/release.yml

Required Forgejo settings:

  1. Add repository secret RELEASE_AUTHOR_TOKEN with permission to push tags/commits and create releases.
  2. Ensure GITHUB_TOKEN is available to workflows for checkout.
  3. Optionally add repository variable FORGEJO_URL if your instance URL is not auto-detected.
  4. Optionally set RELEASE_AUTHOR_NAME and RELEASE_AUTHOR_EMAIL repository variables to control git author metadata for release commits.

Useful local commands:

  • bash bin/package-plugin.sh to build the plugin zip
  • npx semantic-release --dry-run to preview the next release locally

Notes

  • Markdown rendering is done by an internal lightweight parser for common Markdown syntax.
  • Output is sanitized through WordPress HTML sanitization.

License

This project is licensed under the MIT License. See LICENSE.