Tutorials

Publish Pluginon the WordPress repository with GitHub Actions!

This article will surely speak toPlugin WordPress developers who post to the WordPress repository... and those who don't post to the WordPress repository so that 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 are particularly fond of and very much used in the Open-Source world.

A few weeks ago, GitHub released the Github shares.

OK mais qu’est ce que c’est Github actions?

In simple, it is a solution to automate tasks when an action occurs on a deposit or a branch of a deposit (pull / push ...)

That's where it gets interesting!

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

It works... but it's long and boring!

Thanks 10Up!

10Up est l’une des grosses agence WordPress dans le monde et ils viennent de publier une action permettant de publier sur le repo WordPress lorsque l’on push sur une branche d’un repo Git, un Tag particulier.

Ce tag sera repris sur le dépot WordPress afin de publier la nouvelle version de votre travail.

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 improve with time, experience, cough cough cough.

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

Create a file named `main.yml` in the latter directory:

Plain Text
hand.yml

Commit, then push this file.

Github-side parameterization

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

Github Actions

We used a variable SVN_PASSWORD and a SVN_USERNAME corresponding to the SVN IDs needed to publish on the WordPress repo. We'll need to get them to Github so he can connect securely.

Go to the tab "Settings".

Github Actions Settings

Click on "Add a new secret"

Github Secret Shares

In the "Name" input, enter the first variable name, i.e. " "...".SVN_PASSWORD" and enter the password of your wp.org account in the textarea "Value".

Repeat, adapting for the variable corresponding to your password.

Test it!

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

Image à la Une : unsplash-logoKid Circus

Don't miss any of my articles, subscribe to my newsletter

(1 mail per month if there is new content)

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 design. Creating websites under WordPress since 2006 and developing exclusively on Wordpress since 2014. I will create the site orPlugin WordPress you need. Developer ofplugins, Core Contributor, Moderator on the WPFR forumWordPress Translation Manager, WordPress Translation Manager and speaker at WordCampmy life is punctuated by WordPress.

Leave a comment

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

This site uses Akismet to reduce undesirables. Find out more about how your feedback data is used.

facilisis in leo. fringilla Nullam Praesent ut commodo et, massa