WP Plugin Auto-Release (Gitea Actions)
Automatically versions and releases this WordPress plugin whenever the
plugin's Version: header changes on main. No manual tagging, no
hardcoded plugin name/slug — everything is read straight from the plugin's
own file header.
What it does
On every push to main, the workflow at
.gitea/workflows/wp-plugin-release.yml runs:
- Locate the main plugin file — scans all
*.phpfiles for one containing aPlugin Name:header (skipsvendor/,node_modules/,build/). - Extract metadata — reads
Plugin Name:andVersion:from that file's header comment, then derives a slug from the plugin name (e.g.My Cool Plugin→my-cool-plugin). - Check for a new version — looks for a git tag
vX.Y.Zmatching the version found in step 2.- Tag already exists → workflow stops here. Pushing commits without bumping the version does nothing.
- Tag doesn't exist → it's a new release, continue.
- Sync
readme.txt— updates theStable tag:line to match, if the file exists, and commits that change back tomain. - Tag the commit as
vX.Y.Zand push the tag. - Build a zip of the plugin (excluding
.git,.gitea,.github,node_modules,build), named<slug>-<version>.zip. - Publish a Gitea Release for the new tag with the zip attached as a downloadable asset.
Requirements
- A Gitea Actions runner (
act_runner) registered on your instance. - The runner image needs
rsync,zip, andgitavailable (standard onubuntu-latest-style runner images). - A repo secret named
RELEASE_TOKEN— a Gitea access token with repo write / release permissions. Add it under Repo → Settings → Secrets.
Usage
-
Bump the version in your plugin's main file header:
/** * Plugin Name: My Cool Plugin * Version: 1.3.0 */ -
Commit and push to
main:git add . git commit -m "Release 1.3.0" git push origin main -
The workflow detects the new version, tags
v1.3.0, buildsmy-cool-plugin-1.3.0.zip, and publishes it as a Gitea release — nothing else to do.
Plugin file requirements
Your main plugin file must use the standard WordPress header format,
with Plugin Name: and Version: inside the top /** ... */ comment
block:
<?php
/**
* Plugin Name: My Cool Plugin
* Description: Does cool things.
* Version: 1.3.0
* Author: You
*/
If your header format differs significantly (e.g. Version defined only as a PHP constant with no header line), the parsing step in the workflow will need a small adjustment.
Notes & caveats
- One release per version. If you push multiple commits without
changing
Version:, no new tag/release is created — this avoids duplicate releases on every push. readme.txtsync only runs if the file exists at the repo root; it's skipped otherwise.- Tags are immutable once created by this workflow — to "redo" a release, delete the tag and Gitea release first, then push again.
- The zip excludes
.git,.gitea,.github,node_modules, andbuild— add more--excludepatterns in the "Build plugin zip" step if you have other dev-only directories (e.g.tests/,.vscode/).