Non classé

Publish your WordPress plugin thanks to Github Actions!

This article will surely speak to WordPress extension developers who publish to the WordPress repository… and those who don’t publish to it so they don’t have to use SVN.

Indeed SVN is in a way the ancestor of GIT and nowadays rare are the developers who have not switched to Git.

Github is a service hosting GIT repositories that devs like particularly and very much used in the Open-Source world.

A few weeks ago, GitHub released the Github actions.

OK, but what is Github actions?

Simply put, it’s a solution to automate tasks when an action occurs on a repository or a branch of a repository (pull / push…)

That’s where it gets interesting!

Previously, for my personal example, I would version my code on Github and then I would transfer my WordPress extension files by hand to the WordPress.org SVN.

It works… but it’s long and boring!

Thanks 10Up!

10Up is one of the big WordPress agencies in the world and they just published an action that allows you to publish on the WordPress repo when you push on a branch of a Git repo, a particular Tag.

This tag will be included in the WordPress repository in order to publish the new version of your work.

How do we do it?

I don’t know if it’s the way to do it the right way as they say… but it’s the way I use it… it will surely get better with time, experience, cough cough cough.

In my project, I create a .github folder, note the dot in front and then a workflows subfolder.

Create in this last folder a file named `main.yml`:

Commit, then push this file.

Github Settings

Go to your Github repository, in the “Actions” tab you should find the action created earlier.

Marque
Github Actions

We used a SVN_PASSWORD variable and a SVN_USERNAME corresponding to the SVN IDs needed to publish on the WordPress repo. We’ll need to pass them to Github so that it can connect securely.

Go to the “Settings” tab.

page Web
Github Actions Settings

Click on “Add a new secret”

Capture d'écran
Github Actions Secret

In the “Name” input, enter the 1st variable name “SVN_PASSWORD” and enter the password of your wp.org account in the “Value” textarea.

Repeat, adapting for the variable corresponding to your password.

Test!

If all went well, the next time you create and push a Git tag, your extension will automatically be published to the Official WordPress repository.

Post Thumbnail: Kid Circus

Subscribe to my newsletter

About the Author

Avatar - Sebastien Serre

Sebastien Serre

Passionate about the web since the late 1990s, I have developed over the years skills in web creation. Creating WordPress websites since 2006 and developing exclusively on Wordpress since 2014. I would create the site or WordPress extension you need. Developer of extensions, Core contributor, Moderator on the WPFR forum, WordPress translator and speaker on WordCamp, my life is punctuated by WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *

dapibus quis vulputate, sem, odio suscipit nec consequat.