< All Topics
Print

Required Headers

This plugin was designed to simply update any GitHub hosted WordPress plugin or theme. Your plugin or theme must contain a header in the style.css header or in the plugin’s header denoting the location on GitHub. The format is as follows.

GitHub Plugin URI: afragen/git-updater
GitHub Plugin URI: https://github.com/afragen/git-updater

or

GitHub Theme URI: afragen/test-child
GitHub Theme URI: https://github.com/afragen/test-child

…where the above URI leads to the owner/repository of your theme or plugin. The URI may be in the format
https://github.com/<owner>/<repo> or the short format <owner>/<repo>. You do not need both. Only one Plugin or Theme URI is required. You should not include any extensions like .git.

Refer to Usage for more information about required headers.

Primary Branch

An optional header is available for use if your plugin or theme has a primary branch other than master. Historically a new repository created in GitHub was created with a master branch. This has changed and new repositories are created in a main branch. You must add the Primary Branch: main header to your repository’s main plugin file or theme’s style.css file or the API will respond with a 404 error when checking.

The default is still master and for historical reasons this has been more consistent among GitHub, Bitbucket, GitLab, etc. If you, as a developer, wish to use another branch as your production-ready branch, as in git-flow, you can now set this via the Primary Branch header.

Example, Primary Branch: main if you have changed your repository to use main instead of master.

Release Assets

An optional header is available for use if your plugin or theme requires updating via a release asset.

Use Release Asset:. eg., Release Asset: true.

Your release asset filename might be generated automatically. While there is no restriction on what the release asset may be named, if there are more than one release assets per release, then naming restrictions will be required in the following format. The asset name used for updating must be in the following format, $repo-$tag.zip.

Example, $repo-$tag.zip where $repo is the repository slug and $tag is the newest release tag, example test-plugin-0.7.3.zip.

There is support for GitLab Releases & Build Artifacts which may be used as a release asset. You must also add the header, GitLab CI Job:, with the build job name.

GitLab recently has changed it so the free tier is no longer able to authenticate in order download a CI job. You must be on one of the paid tiers. This means updating or branch switching will error if your GitLab user is on the free tier.

https://docs.gitlab.com/ee/api/job_artifacts.html

Branch switching will not be available for repositories using release assets to update.

You must tag your releases to use this feature.

If your current version number and version number inside a release asset do not match you can end up in an endless cycle of seeing an update and then updating to an older release asset. Git Updater checks the repository for the version number but will serve the latest release asset as the download package.

Table of Contents