Managing Release on GITHUB

Managing Release on GITHUB

I was working around a few days back, managing the release of the project with versioning and proper tags associated with it which results in writing the python code.

I have written a simple python function that will call the API of Github and will Create/Fetch /Delete the release on GitHub.

Note**

You can manage the same with CURL command too but I was facing some authentiction issue, so haven’t done, I haven’t tried with explicitly passing the auth token in header by -H tag, you can give a try.

Have a look at the below snippet of code which can be easily integrated with Jenkins pipeline.

Here, tag_name and releaseId variables are only required if you want to delete a particular release, which you will rarely come across.

The above code will be used to fetch the latest release present on Github.

This snippet of code is used to create the release on GitHub, which contains paylod in JSON format.

release.json will look something like below,

Even with this payload, you can easily create prerelease of the master branch, which can be tested in the Staging environment.

The above deletion method is not often required.

The full script is available in the below repository.

Github Link: https://github.com/nik0811/github-release-api.git

Feel free to comment below, if you will found any mistakes or required any type of modifications/enhancement. The code is fully tested so hopefully, you will not find any issues.

Askops
Askops
Developer: Nikhil raj
Price: Free

Leave a Reply