- Python 3.11 or higher
- Poetry (https://python-poetry.org/)
- Git
- Clone the repository:
git clone https://github.com/sequentech/release-bot.git
cd release-bot- Install
release-toolfirst (required dependency):
# Clone release-tool if you don't have it
cd ..
git clone https://github.com/sequentech/release-tool.git
cd release-tool
poetry install
cd ../release-bot- Install release-bot dependencies:
poetry installThis will:
- Create a virtual environment
- Install all dependencies (PyGithub, pytest, etc.)
- Install development dependencies (pytest, pytest-cov, pytest-mock)
Note: For local development, release-tool must be installed separately and available in your Python environment. In Docker, it's pre-installed in the base image.
poetry run pytest tests/ -vpoetry run pytest tests/ -v --cov=src --cov-report=term-missingpoetry run pytest tests/ --cov=src --cov-report=html
open htmlcov/index.htmlpoetry run pytest tests/test_run_pull.py -vpoetry run pytest tests/test_run_pull.py::TestRunPull::test_run_pull_success -vrelease-bot/
├── src/
│ └── main.py # Main bot logic and entry point
├── tests/
│ ├── test_pr_merge_detection.py # Tests for PR merge automation
│ └── test_run_pull.py # Tests for pull command
├── .github/
│ └── workflows/
│ ├── test.yml # CI tests workflow
│ ├── docker_publish.yml # Docker build workflow
│ └── release.yml # Release workflow
├── pyproject.toml # Poetry configuration
├── poetry.lock # Locked dependencies
├── Dockerfile # Docker container
├── action.yml # GitHub Action metadata
└── README.md # User documentation
- Create a new branch:
git checkout -b feature/my-feature-
Make your changes and add tests
-
Run tests to ensure everything works:
poetry run pytest tests/ -v- Commit your changes:
git add .
git commit -m "Description of changes"- Push and create a pull request
The project uses GitHub Actions for CI/CD:
-
Tests: Runs on every push and PR
- Tests on Python 3.11 and 3.12
- Runs all unit tests
- Generates coverage report
-
Docker: Builds Docker image
- Triggered on tag push or manual dispatch
poetry add package-namepoetry add --group dev package-namepoetry updatepoetry showdocker build -t release-bot:dev .Note: The Dockerfile uses ghcr.io/sequentech/release-tool:main as the base image, which already includes:
- Python 3.10+
release-toolpackage pre-installed- All release-tool dependencies
The release-bot Dockerfile only installs additional dependencies (PyGithub) via Poetry.
docker run --rm -e INPUT_COMMAND=generate -e GITHUB_TOKEN=xxx release-bot:devThe Docker build:
- Starts from
ghcr.io/sequentech/release-tool:mainbase image - Installs Poetry
- Copies
pyproject.tomlandpoetry.lock - Runs
poetry install --only main --no-rootto install PyGithub - Copies source code
- Sets Python entrypoint to
/app/src/main.py
Since release-tool is in the base image, Poetry doesn't need to install it.
poetry run python src/main.pySet environment variables to simulate GitHub Actions:
export INPUT_DEBUG=true
export INPUT_COMMAND=generate
export GITHUB_REPOSITORY=test/repo
export GITHUB_TOKEN=your_token
poetry run python src/main.pySince release-tool is installed from the parent directory, changes to it require:
poetry update release-toolpoetry run flake8 src/ tests/poetry run black src/ tests/Install Poetry: curl -sSL https://install.python-poetry.org | python3 -
Delete and recreate: poetry env remove python && poetry install
Run with verbose output: poetry run pytest tests/ -vv -s
Ensure project is installed: poetry install
- Update version in
pyproject.toml - Update CHANGELOG or release notes
- Commit changes:
git commit -am "Bump version to X.Y.Z" - Create tag:
git tag vX.Y.Z - Push:
git push && git push --tags - GitHub Actions will build and publish Docker image