Hi everyone, today we will complete our three-posts mini series on Git, Github and WordPress. We have already seen the basics of Git and Github and how to place our WordPress plugin on Github. Now we will see how to update at one time our plugin on Github and in WordPress repository.

So let’s get started!

UPDATE OUR PLUGIN ON GITHUB
First of all let’s suppose we have to edit something in our WordPress plugin. For our ease we just change some Readme text of our plugin called Admin Notices for Team. In our case let’s say we just update the WordPress version number for which we tested our plugin.
/* BEFORE */
/* AFTER */
Now we have to update our Github plugin; we just override our Readme.txt file in our local Github Repo, then open GitHub Desktop app (but you obviouly can do it also from Github website as we saw here) and we will see our changes.
We write a Summary and a very short description and click on ‘Commit to master’ blue button; now we click on Push Origin button and that’s all! Our Github plugin will be updated.
DOWNLOAD THE SHELL SCRIPT
Once updated the Github repo, we have to search on Github itself for the following .sh shell script: github-to-wordpress-deploy-script .
This is a simple but very useful script through which we can update the WordPress Repository (REMEMBER you have to have already an active repository on WordPress, so this script will work only for updates and not for the first plugin release!) in sync with the Github code.
Once downloaded you will see a folder with four files inside: demo.gif, LICENSE, the README.md and the release.sh script file. In the Demo file you will see all the screenshots of the terminal commands you have to run to update your plugin from Github to WordPress, so if you have any doubt try open this file and follow step by step the process.
RUN THE SHELL COMMAND
Before to move to the Terminal, we have to follow a preliminary step. As explained in the Readme.md we need to let the script know what repositories (the Github and the WordPress ones) to put in communication with.
To do this, we just have to edit our ‘release.sh’ file but before we will need, however, four simple informations:
1) the GITHUB ACCESS TOKEN; // you can get this going to Github Settings -> Developer Settings -> Personal access tokens and clicking on Generate new token

2) the WORDPRESS PLUGIN SLUG; // this is the WordPress plugin slug that appears in the WP directory (in our case will be: admin-notices-for-team)

3) the GITHUB REPO OWNER; // this is the name of the Github repository owner
4) the GITHUB REPO NAME; // this is the name of the Github repository

Once you have these informations just open the ‘release.sh’ file and paste these in the right place:

Ok, now we just have to open our Terminal (or similar shell command tool if you are on different OS) and run the command ‘cd‘ followed by the folder directory in which we have previously copied and pasted our ‘release.sh’ file. In our case we have the file located in ‘Programming/Tools’ path so our first command line will look like this:

“cd desktop/Programming/Tools/”

Then just run the following line:

“sh release.sh”

Now we have to specify the Tag and Release Version number, in our case 1.0.4 (cause we are just updating a file without releasing a new plugin version), and press Enter. You will have then to press Enter for each question the Terminal will ask (and obviously take care to check you have done all the steps required!). Finally press again Enter to start releasing your new version.
The script will first check out the WordPress Subversion Repository, then cloning Git repository from Github and returns this screen:
You just have to type master if you want to deploy the master branch, press Enter and press Enter again. The script will take care of committing and sending the data to WordPress.org. All done. Now your plugin will be updated also on the WordPress Directory!
FINAL THOUGHTS
All done! Our WordPress plugin has been perfectly updated either on Github either on WordPress with just one real update and few simple terminal commands. If you like to work mainly on Github you may love this trick for speed your updating process, a simple shell script, more efficiency, less worries.

See you next post!

 

SupportHost

You have Successfully Subscribed!

CodeCanyon Plugins

You have Successfully Subscribed!

Elegant Themes

You have Successfully Subscribed!

Try Divi!

You have Successfully Subscribed!

Divi Plugins

You have Successfully Subscribed!

Advanced Blurbs Plugin

You have Successfully Subscribed!

Bloom!

You have Successfully Subscribed!

Divi Cake Layouts

You have Successfully Subscribed!

Divi Cake Plugins

You have Successfully Subscribed!