CLI
Release tools for bash workflows - a comprehensive toolkit of bash scripts for various CI/CD purposes including version management, release automation, and workflow utilities.
This toolkit represents a collection of bash scripts for various purposes. At the time of this writing, this is a work in progress, with more utilities being added as scripts are centralized from various repositories.
Any and all contributions are welcome; just open a PR.
Quickstart
1. Install the tools
Choose your preferred installation method:
Using curl
bash <(curl -sSL "https://github.com/releasetools/cli/releases/download/v0.0.11/install.sh")
Using wget
bash <(wget -q -O- "https://github.com/releasetools/cli/releases/download/v0.0.11/install.sh")
Using Homebrew
brew tap releasetools/tap
brew install rt
The tools will by default be installed to ~/.local/share/releasetools/cli/VERSION/ and a binary will be symlinked at ~/.local/bin/rt.
2. Utilize the releasetools library
# With ~/.local/bin in your PATH:
export PATH=~/.local/bin:"$PATH"
# You can run commands, e.g.:
rt base::::version
# vX.Y.Z
# Optionally, check that all dependencies for all modules are correctly installed
rt base::check_deps
# Ok.
# You can also check the install location
rt base::install_location
# /Users/user/.local/share/releasetools/cli/vX.Y.Z/releasetools.bash
Customizations
Several customizations can be applied prior to installation:
1. Installation Directory
Customize the location where the tools will be installed:
export RELEASETOOLS_INSTALL_DIR="$HOME/.local/share"
# proceed with the installation steps outlined above
2. Binary Location
Customize the path where the binary is symlinked:
export RELEASETOOLS_BINARY_DIR="$HOME/.local/bin"
# proceed with the installation steps outlined above
GitHub Action
The releasetools/cli library can be installed via a GitHub workflow:
Basic Usage
steps:
# Install releasetools
- uses: releasetools/cli@v0
# Check that releasetools was installed correctly
- run: rt base::check_deps
Advanced Configuration
A few customizations are available, if needed:
steps:
# Install releasetools with customizations
- uses: releasetools/cli@v0
with:
# Pin a specific version (defaults to latest)
version: "v0.0.11"
env:
# Configure the installation directory
RELEASETOOLS_INSTALL_DIR: /home/runner/.local/share
# Configure where binaries are linked (e.g. a directory that is already in PATH)
RELEASETOOLS_BINARY_DIR: /home/runner/.local/bin
# Check that releasetools was installed correctly
- run: rt base::check_deps
Release tools uses python for certain actions. When installed as part of a workflow, it will attempt to install the required dependencies, if pip is available in the PATH.
Recommended Setup with Python
If the workflow also needs python, it is recommended to install it before releasetools to avoid having to install dependencies separately:
steps:
# Install Python first, to avoid having to install dependencies separately
- uses: actions/setup-python@v5
with:
python-version: "3.11"
# Will install releasetools and necessary python dependencies
- uses: releasetools/cli@v0
Available Commands
The releasetools CLI provides various modules and commands. Here are some common usage patterns:
Base Module
# Check version
rt base::::version
# Verify all dependencies are installed
rt base::check_deps
# Get installation location
rt base::install_location
Git Module
# Create and push a release tag
rt git::release --major --sign --force --push v1.0.0
# Check if working directory is clean
rt git::is_clean
# Get current branch name
rt git::current_branch
Utility Functions
# List available modules
rt --help
# Get help for specific module
rt git --help
Use Cases
Release Automation
Automate your release process with standardized tagging:
name: Release
on:
push:
branches: [ main ]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: releasetools/cli@v0
- name: Create Release
run: |
# Create and push a new release tag
rt git::release --major --sign --push v$(date +%Y%m%d)
Version Management
Manage versions across your projects:
# Get current version
current_version=$(rt base::::version)
# Create a new release
rt git::release --minor --push "v${current_version}"
CI/CD Integration
Integrate with your existing CI/CD pipelines:
- name: Setup Release Tools
uses: releasetools/cli@v0
- name: Validate Environment
run: rt base::check_deps
- name: Deploy if Clean
run: |
if rt git::is_clean; then
echo "Working directory is clean, proceeding with deployment"
# Your deployment commands here
else
echo "Working directory has uncommitted changes"
exit 1
fi
Development
You can find the code and development guidelines in the src/ directory.
Setting Up Development Environment
-
Clone the repository:
git clone https://github.com/releasetools/cli.git
cd cli -
Install development dependencies:
# Install any required dependencies
pip install -r requirements.txt -
Run tests:
# Run the test suite
./scripts/test.sh
Contributing
We welcome contributions! Here's how you can help:
- Fork the repository on GitHub
- Create a feature branch for your changes
- Write tests for new functionality
- Follow existing code style and conventions
- Submit a pull request with a clear description
Code Structure
src/- Main source code directoryscripts/- Build and utility scriptstests/- Test filesrequirements.txt- Python dependencies
Releasing
Once you have completed and tested the code, see the release instructions.
Creating a New Release
# Use rt itself to create releases
rt git::release --major --sign --force --push v1.0.0
Installation Verification
After installation, verify that rt is working correctly:
# Check if rt is in PATH
which rt
# Verify version
rt base::::version
# Check all dependencies
rt base::check_deps
# List available commands
rt --help
Troubleshooting
Common Issues
rt command not found
- Ensure
~/.local/binis in your PATH - Verify the installation completed successfully
- Check that the symlink was created:
ls -la ~/.local/bin/rt
Permission denied errors
- Make sure you have write permissions to the installation directories
- Consider customizing
RELEASETOOLS_INSTALL_DIRandRELEASETOOLS_BINARY_DIR
Missing dependencies
- Run
rt base::check_depsto identify missing requirements - Install missing dependencies based on the error messages
- For Python dependencies, ensure
pipis available
GitHub Action failures
- Verify the action version is correct
- Check that required environment variables are set
- Ensure Python is installed if using Python-dependent features
Getting Help
If you encounter issues:
- Check existing issues: Look at the GitHub Issues for similar problems
- Run diagnostics: Use
rt base::check_depsto identify environment issues - Check installation: Verify with
rt base::install_location - Open an issue: Provide detailed information about your environment and the problem