Some bash scripts that call the Github API (specifically, the releases and assets API)
- make sure you install
curl
andjq
# Debian/Ubuntu
sudo apt -y install curl jq
# Red Hat
yum install curl jq
# Arch
pacman -Sy curl jq
# This code may or may not work on WSL
# TODO: powershell command to get curl and jq goes here
- this code requires
bash
- make sure you echo out your Github Personal Access Token into the same directory as the
runner
script
echo -ne 'ghp_mysupersecrettoken' > token
# Then do a test call to one of your repos
./runner list user repo
- If you see this when running
./runner ...
, it means you haven't placed your Github Personal Access Token into the filetoken
.- follow steps in
Initializing your token file
above
- follow steps in
All scripts are accessible by the runner
script
# Example. To list the releases for this repo, I would use:
./runner list wmerfalen bash-release
To see the Usage/help screen, run:
./runner --help
./runner list USER REPO
./runner create USER REPO TAG NAME_OF_RELEASE
./runner list-release-assets USER REPO RELEASE_ID
./runner upload-release-asset USER REPO RELEASE_ID PATH_TO_FILE NAME_OF_ASSET
# Example
./runner upload-release-asset wmerfalen bls 12345678 ~/documents/ubuntu-x86-64-focal.zip ubuntu-x86-64-focal.zip
./runner upload-targz-release-asset USER REPO RELEASE_ID PATH_TO_FILE NAME_OF_ASSET
# Example
./runner upload-targz-release-asset wmerfalen bls 12345678 ~/documents/ubuntu-x86-64-focal.tar.gz ubuntu-x86-64-focal.tar.gz
./runner delete-release-asset USER REPO ASSET_ID
# Example
./runner delete-release-asset wmerfalen bls 12345678
Sometimes you might want to pass in arguments to a script without actually calling the curl
binary. This might be useful for a number of ways. If you'd like this functionality, set an environment variable named GITHUB_DONT_SEND
to any value and all scripts will exit just prior to calling curl
.
MIT
v1.1.0
x - major release y - minor release z - build number
Example:
v3.0.4
3 - major
0 - minor
4 - build number