Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Semantic Release and PyPI Publish
on:
push:
branches:
- main
jobs:
semantic-release:
runs-on: ubuntu-latest
outputs:
new_release_published: ${{ steps.semantic_release.outputs.new_release_published }}
new_release_version: ${{ steps.semantic_release.outputs.new_release_version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install python-semantic-release build wheel
- name: Configure Git
run: |
git config --global user.name "github-actions"
git config --global user.email "action@github.com"
- name: Semantic Release
id: semantic_release
run: |
semantic-release version
semantic-release publish
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update VERSION.txt file
if: steps.semantic_release.outputs.new_release_published == 'true'
run: |
echo "${{ steps.semantic_release.outputs.new_release_version }}" > src/jpl/slim/VERSION.txt
git add src/jpl/slim/VERSION.txt
git commit -m "chore: update VERSION.txt to ${{ steps.semantic_release.outputs.new_release_version }}"
git push
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build:
needs: semantic-release
if: needs.semantic-release.outputs.new_release_published == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main # Ensure we get the latest commit with version update
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Upgrade tooling
run: |
python -m pip install --upgrade pip
pip install --upgrade build wheel twine
- name: Build package
run: python -m build .
- name: Verify package
run: twine check dist/*
- name: Store package
uses: actions/upload-artifact@v4
with:
name: python-package-distribution
path: |
dist/*.whl
dist/*.tar.gz
if-no-files-found: error
publish:
runs-on: ubuntu-latest
needs: build
environment:
name: release
permissions:
id-token: write # mandatory for trusted publishing
steps:
- name: Retrieve package
uses: actions/download-artifact@v4
with:
name: python-package-distribution
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true
repository-url: https://upload.pypi.org/legacy/
38 changes: 29 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
# Changelog
# CHANGELOG

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v0.0.12 (2025-05-02)

## [X.Y.Z] - 2022-MM-DD
### Bug Fixes

### Added
- Version file manage
([`aa26e7a`](https://github.com/yunks128/slim-cli/commit/aa26e7aadf66e584c3fb4ec0f1fb8012b4988ae7))

-
-
-

## v0.0.11 (2025-05-02)

### Bug Fixes

- Test semantic-release
([`e9c423a`](https://github.com/yunks128/slim-cli/commit/e9c423a9ecaa6432d8e5e0885ad355de4dc8e99b))


## v0.0.10 (2025-04-27)


## v0.0.9 (2025-04-27)

### Bug Fixes

- Semantic release workflow
([`61a0d28`](https://github.com/yunks128/slim-cli/commit/61a0d28ff648ac73d0c37ce4f59f873d596d6e45))

- Semantic release workflow merged into pypi workflow
([`bb5e986`](https://github.com/yunks128/slim-cli/commit/bb5e986dfa6da1a12f997fabd0cecb99cf04f5bc))


## v0.0.8 (2025-04-15)
62 changes: 56 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ SLIM CLI is a command-line tool designed to infuse SLIM best practices seamlessl
- [Contributing](#contributing)
- [Running Tests](#running-tests)
- [Publishing a New Version](#publishing-a-new-version)
- [How It Works](#how-it-works)
- [Commit Message Format](#commit-message-format)
- [Examples](#examples)
- [License](#license)
- [Support](#support)

Expand Down Expand Up @@ -397,14 +400,61 @@ pytest -v -s

### Publishing a New Version

To publish a new version of SLIM CLI to the Python Package Index, typically you'll update the `VERSION.txt` file; then do:
```bash
pip install build wheel twine
python3 -m build .
twine upload dist/*
This project uses semantic versioning with automated release management. New versions are automatically published based on conventional commit messages.

#### How It Works

1. The project uses `python-semantic-release` to analyze commit messages and determine the appropriate version bump
2. When changes are pushed to the `main` branch, a GitHub Actions workflow automatically:
- Determines the next version number based on commit messages
- Updates the version in `src/jpl/slim/VERSION.txt`
- Creates a GitHub release
- Builds and publishes the package to PyPI using trusted publishing

#### Commit Message Format

To properly trigger version updates, follow the [Conventional Commits](https://www.conventionalcommits.org/) format:

```
<type>[optional scope]: <description>

[optional body]

[optional footer(s)]
```

Where `type` is one of:

- `feat`: A new feature (triggers a minor version bump)
- `fix`: A bug fix (triggers a patch version bump)
- `docs`: Documentation changes (no version bump)
- `style`: Code style changes (no version bump)
- `refactor`: Code refactoring (no version bump)
- `perf`: Performance improvements (no version bump)
- `test`: Adding or fixing tests (no version bump)
- `build`: Changes to build system (no version bump)
- `ci`: Changes to CI configuration (no version bump)
- `chore`: Other changes (no version bump)

Include `BREAKING CHANGE:` in the commit footer to trigger a major version bump.

#### Examples

Patch release (bumps 1.2.3 to 1.2.4):
```
fix: resolve issue with command line argument parsing
```

(Note: this can and should eventually be automated with GitHub Actions.)
Minor release (bumps 1.2.3 to 1.3.0):
```
feat: add support for custom configuration files
```

Major release (bumps 1.2.3 to 2.0.0):
```
feat: migrate to new API architecture

```

## License

Expand Down
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = 'slim-cli'
dynamic = ['version']
requires-python = '>=3.7'
requires-python = '>=3.9'
dependencies = [
# Note: these dependencies were taking from original `requirements.txt`
# file (now retired in favor of this file, `pyproject.toml`). However,
Expand Down Expand Up @@ -62,3 +62,12 @@ packages = ['src/jpl']
[build-system]
requires = ['hatchling']
build-backend = 'hatchling.build'


[tool.semantic_release]
version_source = "commit"
branch = "main"
upload_to_pypi = true
upload_to_release = true
build_command = "python -m build"
version_variable = ["src/jpl/slim/VERSION.txt:"]
2 changes: 1 addition & 1 deletion src/jpl/slim/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.7
0.0.11