|
| 1 | +# Deployment Process |
| 2 | + |
| 3 | +This document explains the automated deployment process for the project. The publish process is triggered **automatically on version change** (i.e. when the version in `killercoda_cli/__about__.py` is updated) and runs on the `main` branch. |
| 4 | + |
| 5 | +## What It Does |
| 6 | + |
| 7 | +1. **Version Detection** |
| 8 | + - The process reads the new version from `killercoda_cli/__about__.py` and sets it as the `PYPI_VERSION`. |
| 9 | + - A version change is considered the trigger for the publish process. |
| 10 | + |
| 11 | +2. **Artifact Build & Upload** |
| 12 | + - The `build` job creates source distributions (sdist) and wheel artifacts. |
| 13 | + - These artifacts are uploaded as GitHub build artifacts for later use. |
| 14 | + |
| 15 | +3. **Artifact Download** |
| 16 | + - In the `publish` job, the artifacts are downloaded using the `actions/download-artifact` action. |
| 17 | + |
| 18 | +4. **Repository Checkout** |
| 19 | + - The repository is checked out to ensure a proper Git context. This is crucial for generating changelogs, creating tags, and pushing them. |
| 20 | + |
| 21 | +5. **Publish to PyPI** |
| 22 | + - The downloaded artifacts are published to PyPI using the `pypa/gh-action-pypi-publish` action. |
| 23 | + - The process uses the PyPI API token from repository secrets to authenticate and perform the upload. |
| 24 | + |
| 25 | +6. **Changelog Generation** |
| 26 | + - The deployment step generates a changelog by inspecting Git commit history: |
| 27 | + - If no previous Git tags are found, it generates a changelog for **all commits**. |
| 28 | + - If a previous tag exists, it includes only commits since the last tag. |
| 29 | + |
| 30 | +7. **Tag Creation & Release** |
| 31 | + - A new Git tag (formatted as `v<version>`, e.g., `v1.2.3`) is created and pushed to the origin. |
| 32 | + - A GitHub release is created using this tag, and the generated changelog is attached as the release body. |
| 33 | + |
| 34 | +## Trigger Conditions |
| 35 | + |
| 36 | +- **Version Change:** |
| 37 | + The publish process is triggered when there is a change in the version (in `killercoda_cli/__about__.py`). |
| 38 | + |
| 39 | +- **Branch Restriction:** |
| 40 | + The process runs on the `main` branch only. |
0 commit comments