DEV Community

Paul
Paul

Posted on • Originally published at boldoak.design

3

Automatically creating the release for a WordPress theme

The new GitHub Action I’ve set up will build a new downloadable copy of a WordPress theme when I create a new release or tag in its GitHub repository. In this regard, it’s still fired off by a manual action, but the uploaded file is automatically attached to the new release. This way I can create a new release and just concern myself with writing the description, without having to manually build the theme and upload its zip file.

My Workflow

My WordPress theme uses Justin Tadlock's Mythic starter theme as its base. As such, it has both Composer and npm dependencies, both of which must be included for the theme to work. To that end, I've created a new GitHub Action called "Generate Installable Theme and Upload as Release Asset" to automate this process.

Alt Text

The action is fired off when I create a new release (through either the Releases or Tags tab), which will download the production build's Composer and npm dependencies. (These are slightly different than a development build, which has linting utilities not used in production.) The theme's internal build process uses webpack to compile CSS and JavaScript assets, so this same process is invoked by the action once all dependencies are downloaded.

The final result is a zip file suitable for upload and installation in WordPress, which is then attached to the aforementioned release (or tag).

Alt Text

Submission Category:

  • DIY Deployments

Yaml File or Link to Code

main.yml

GitHub logo peiche / garrick

Garrick is a modern, multi-purpose WordPress theme built to be compatible with the core block editor and page builder.

Additional Resources / Info

I took inspiration from Leonardo Losoviz's post on how he accomplished a similar process for a WordPress plugin. I probably would have had a more difficult time figuring this out without his code to learn from.


This post was originally published on Bold Oak Design.

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay