Git Command Line Snippets: Get Release Information

GitHubThis post is part of the series on Git Command Line Snippets where I am taking a look at performing actions on GitHub using the git command line.

In the last post, of this series, I covered the command to create a release and mentioned that uploading a release zip (extra asset) had to be handled separately. While the command to do this isn’t too complex, there is one problem; to upload the asset you need the tag d of the release. This is not the tag that you supply to create the release with, but the internal GitHub id which is automatically assigned.

The command below can be used to get the release information, in the form of json, which includes the tag id:

curl -H "Accept: application/vnd.github+json" -H "Authorization: token ghp_authorizationtoken" https://api.github.com/repos/username/repository name/releases/tags/required tag

Git Command Line Snippets: Create Release

GitHubThis post is part of the series on Git Command Line Snippets where I am taking a look at performing actions on GitHub using the git command line.

Once changes have been added, committed and pushed to the repository, we can create a release.

When developing for ClassicPress, there is also a need to upload a release zip which is used for deployment to a ClassicPress site. Unfortunately, this cannot be done while creating a release; this post is just on creating the release and a later post will cover uploading the release zip.

The following command can be used to create a release using command line:

curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: token ghp_authorizationtoken" https://api.github.com/repos/username/repository name/releases -d "{\"tag_name\":\"tagname\",\"target_commitish\":\"main\",\"name\":\"name\",\"body\":\"release comment\",\"draft\":false,\"prerelease\":false,\"generate_release_notes\":false}"

The highlighted sections need to be replaced with the parameters for your GitHub account and repo.

Git Command Line Snippets: Add, Commit and Push Changes

GitHubThis post is part of the series on Git Command Line Snippets where I am taking a look at performing actions on GitHub using the git command line.

There are three steps required to add your changes to a GitHub repository:

  1. Add
  2. Commit
  3. Push

Fistly, you need to add your changes; it is possible to only add specific files, but in my case I always want to add everything; this command will add all changes including added changed or deleted files and folders:

git add --all

Once you have added the changes, you need to commit them; you can supply a commit message, but this should be a maximum of 55 characters.

git commit -m "Release for x and y"

Once you have committed the changes, you need to push them to GitHub for them to appear in the repository:

git push

Git Command Line Snippets: Choose Repository

GitHubThis post is part of the series on Git Command Line Snippets where I am taking a look at performing actions on GitHub using the git command line.

I am new to working with the git command line so have spent a bit of time reading articles. One thing a lot of them say is to “choose your repository” and then tell you to run commands. When I was doing this it was a bit late and I’d been working all day (getting my excuse in early), but I didn’t immediately understand what they meant.

All it means when they say to choose your repository, is to navigate the command prompt to the repository folder on your computer.

In command line you can simply use cd followed by the path: to navigate to the required folder

cd C:\Users\azurecurve\Documents\Development\ClassicPress Development\azrcrv-smtp

In PowerShell you can largely do the same thing but must wrap the path in double quotes if the path contains a space:

cd "C:\Users\azurecurve\Documents\Development\ClassicPress Development\azrcrv-smtp"

Git Command Line Snippets: Update Name and Email

GitHubThis post is part of the series on Git Command Line Snippets where I am taking a look at performing actions on GitHub using the git command line.

Before you start using Git you need to enter your credentials to identify yourself as the author. The name and email address should both be set to the same as the ones you use in GitHub.

To set your username you can use this command:

git config --global user.name "azurecurve"

To set your email address you can use this command:

git config --global user.email "github@example.co.uk"

Git Command Line Snippets: Series Index

GitHubBack in April 2020, I did a series on using GitHub when developing for ClassicPress. More recently I have started to take a look at using the git command line to help automate making commits, releases and other actions. I’ m going to use this git snippets series to record the commands I have been using.

You can use an ordinary Windows command prompt or PowerShell to run git commands; I started out using command line, but did move onto running them in PowerShell as soon as I wanted to run commands sequentially.

If you’re reading this post on azurecurve | Ramblings of an IT Professional, then the post will automatically refresh otherwise check Git Command Line Snippets for new posts.

Continue reading “Git Command Line Snippets: Series Index”

azurecurve ClassicPress Plugins: Load Admin CSS

ClassicPress PluginsThis is part of the azurecurve ClassicPress Plugins series which introduces the plugins I have available for ClassicPress.

The plugin I am going to cover in this post, is one written specifically for ClassicPress ; Load Admin CSS.

Functionality

Change the styling of your admin dashboard with custom CSS.

Options are maintained via a Settings page on the **azurecurve** menu.

Example CSS usage to change the font size in the textarea:

textarea.wp-editor-area{
	font-size: 1.33em;
}

This plugin is multisite compatible, with options set on a per site basis.

Download

The plugin can be downloaded from my GitHub.

Click to show/hide the azurecurve ClassicPress Plugins Series Index

azurecurve ClassicPress Plugins: Strong Password Generator

ClassicPress PluginsThis is part of the azurecurve ClassicPress Plugins series which introduces the plugins I have available for ClassicPress.

The plugin I am going to cover in this post, is one written specifically for ClassicPress ; Strong Password Generator.

Functionality

Create password forms allowing users to create strong passwords consisting of upper/lower case letters, numbers and symbols.

Options are maintained via a Settings page on the **azurecurve** menu.

Password forms are placed using the `strong-password-generator` shortcode and can have a number of parameters supplied to override the defaults from the options page; each shortcode must have an `id` parameter supplied. Available parameters are:

  • password-length – length of password to be generated.
  • password-minimum-length – minimum length of passwords which can be generated.
  • password-maximum-length – maximum length of passwords which can be generated.
  • password-number – number of passwords to generate.
  • password-maximum-number – maximum umber of passwords which user can generate.
  • text-before – text to display before password form.
  • text-after – text to display after password form.
  • label-password-length – label for password length field.
  • label-password-number – label for number of passwords to generate field.
  • label-lowercase – label for valid lowercase field.
  • label-uppercase – label for valid uppercase field.
  • label-numeric – label for valid numbers field.
  • label-symbols – label for valid symbols field.
  • allow-lowercase – allow user to include uppercase characters.
  • allow-uppercase – allow user to include uppercase characters.
  • allow-numeric – allow user to include number.
  • allow-symbols – allow user to include symbols.
  • valid-lowercase – list of valid lowercase characters.
  • valid-uppercase – list of valid uppercase characters.
  • valid-numeric – list of valid numbers.
  • valid-symbols – list of valid symbols.

Example shortcode usage:

[strong-password-generator id="password-1"  text-before="The password generator below can be used to produce passwords compatible with Microsoft Dynamics GP." allow-symbols=1]

This plugin is multisite compatible, with options set on a per site basis.

Download

The plugin can be downloaded from my GitHub.

Click to show/hide the azurecurve ClassicPress Plugins Series Index