Skip to content

Commit c9904a7

Browse files
committed
feat: adding semantic release for automated version updates
1 parent 01208d6 commit c9904a7

File tree

7 files changed

+733
-10
lines changed

7 files changed

+733
-10
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
push:
55
tags:
66
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag to release'
11+
required: true
12+
type: string
713

814
jobs:
915
build:
@@ -24,6 +30,9 @@ jobs:
2430
steps:
2531
- name: Checkout code
2632
uses: actions/checkout@v4
33+
with:
34+
# Fetch the specific tag if triggered by workflow_dispatch
35+
ref: ${{ github.event.inputs.tag || github.ref }}
2736

2837
- name: Set up Python
2938
uses: actions/setup-python@v5
@@ -40,7 +49,7 @@ jobs:
4049
run: poetry run pytest
4150

4251
- name: Build PyInstaller binary
43-
run: poetry run python scripts/build_pyinstaller.py
52+
run: poetry run build-pyinstaller
4453

4554
- name: Create platform-specific tarball (Linux)
4655
if: matrix.platform == 'linux'
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Semantic Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
issues: write
12+
pull-requests: write
13+
id-token: write
14+
15+
jobs:
16+
semantic-release:
17+
runs-on: ubuntu-latest
18+
concurrency: release
19+
if: github.repository == 'ni-kismet/systemlink-cli'
20+
21+
outputs:
22+
released: ${{ steps.release.outputs.released }}
23+
version: ${{ steps.release.outputs.version }}
24+
tag: ${{ steps.release.outputs.tag }}
25+
26+
steps:
27+
- name: Checkout code
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
token: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: '3.11'
37+
38+
- name: Install Poetry
39+
run: pip install poetry
40+
41+
- name: Install dependencies
42+
run: poetry install
43+
44+
- name: Run tests
45+
run: poetry run pytest
46+
47+
- name: Python Semantic Release
48+
id: release
49+
uses: python-semantic-release/python-semantic-release@v9.14.0
50+
with:
51+
github_token: ${{ secrets.GITHUB_TOKEN }}
52+
git_committer_name: "github-actions[bot]"
53+
git_committer_email: "github-actions[bot]@users.noreply.github.com"
54+
55+
trigger-build:
56+
needs: semantic-release
57+
runs-on: ubuntu-latest
58+
if: needs.semantic-release.outputs.released == 'true'
59+
60+
steps:
61+
- name: Trigger Release Build
62+
uses: actions/github-script@v7
63+
with:
64+
github-token: ${{ secrets.GITHUB_TOKEN }}
65+
script: |
66+
const tag = '${{ needs.semantic-release.outputs.tag }}';
67+
console.log(`Triggering release build for tag: ${tag}`);
68+
69+
// The release.yml workflow will be triggered by the tag creation
70+
// from semantic-release, so no additional action needed here

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
- Semantic release automation for version management
12+
- Automated version bumping based on conventional commits
13+
- Enhanced version command that works in both development and built environments
14+
- Graceful error handling for workspace permission errors
15+
16+
### Changed
17+
- Version command now reads from auto-generated `_version.py` in built binaries
18+
- Build process now automatically generates version file during packaging
19+
20+
### Fixed
21+
- Version command now works correctly in PyInstaller-built binaries
22+
- Workspace info command handles permission errors gracefully instead of crashing
23+
24+
## [0.3.1] - 2025-01-XX
25+
26+
### Added
27+
- SystemLink Integrator CLI for managing workflows, templates, notebooks, and workspaces
28+
- Cross-platform support (Windows, macOS, Linux)
29+
- Authentication via API keys stored in system keyring
30+
- JSON and table output formats for list commands
31+
- Comprehensive error handling with user-friendly messages
32+
33+
### Features
34+
- **Workspace Management**: List, disable, and get detailed workspace information
35+
- **Template Management**: List and manage test plan templates
36+
- **Workflow Management**: List and manage SystemLink workflows
37+
- **Notebook Management**: Create, download, delete, and list Jupyter notebooks
38+
- **Authentication**: Secure login/logout with API key storage

docs/semantic-release.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Semantic Release Setup
2+
3+
This project uses [Python Semantic Release](https://python-semantic-release.readthedocs.io/) for automated version management and releases.
4+
5+
## How It Works
6+
7+
1. **Conventional Commits**: Use conventional commit messages to automatically determine version bumps
8+
2. **Automated Releases**: On push to `main`, the semantic release workflow analyzes commits and creates releases
9+
3. **Version Management**: Automatically updates version in `pyproject.toml` and generates `_version.py`
10+
4. **Changelog**: Automatically generates and updates `CHANGELOG.md`
11+
12+
## Commit Message Format
13+
14+
Use conventional commit format:
15+
16+
```
17+
<type>[optional scope]: <description>
18+
19+
[optional body]
20+
21+
[optional footer(s)]
22+
```
23+
24+
### Types
25+
26+
- `feat`: A new feature (triggers minor version bump)
27+
- `fix`: A bug fix (triggers patch version bump)
28+
- `docs`: Documentation only changes
29+
- `style`: Changes that do not affect the meaning of the code
30+
- `refactor`: A code change that neither fixes a bug nor adds a feature
31+
- `perf`: A code change that improves performance (triggers patch version bump)
32+
- `test`: Adding missing tests or correcting existing tests
33+
- `build`: Changes that affect the build system or external dependencies
34+
- `ci`: Changes to CI configuration files and scripts
35+
- `chore`: Other changes that don't modify src or test files
36+
37+
### Examples
38+
39+
```bash
40+
# Patch release (0.3.1 -> 0.3.2)
41+
git commit -m "fix: handle permission errors gracefully in workspace info"
42+
43+
# Minor release (0.3.1 -> 0.4.0)
44+
git commit -m "feat: add new version command"
45+
46+
# Major release (0.3.1 -> 1.0.0) - requires BREAKING CHANGE footer
47+
git commit -m "feat: redesign API structure
48+
49+
BREAKING CHANGE: API endpoints have been restructured"
50+
```
51+
52+
## Workflows
53+
54+
### Semantic Release Workflow
55+
- **File**: `.github/workflows/semantic-release.yml`
56+
- **Trigger**: Push to `main` branch
57+
- **Actions**: Analyzes commits, bumps version, creates tags, generates changelog
58+
59+
### Release Build Workflow
60+
- **File**: `.github/workflows/release.yml`
61+
- **Trigger**: New tags created by semantic release
62+
- **Actions**: Builds binaries for all platforms, creates GitHub releases
63+
64+
## Manual Commands
65+
66+
```bash
67+
# Dry run to see what would happen
68+
poetry run semantic-release version --noop
69+
70+
# Generate changelog only
71+
poetry run semantic-release changelog
72+
73+
# Manual version bump (for testing)
74+
poetry run semantic-release version
75+
76+
# Update version file manually
77+
poetry run update-version
78+
```
79+
80+
## Configuration
81+
82+
Semantic release configuration is in `pyproject.toml` under `[tool.semantic_release]`:
83+
84+
- Version files: `pyproject.toml` and `slcli/_version.py`
85+
- Build command: Runs `update-version` script to sync version files
86+
- Branch: `main`
87+
- Upload to PyPI: Disabled
88+
- Upload to GitHub Releases: Enabled
89+
- Changelog: Generated in `CHANGELOG.md`

0 commit comments

Comments
 (0)