Skip to content

Commit eae9104

Browse files
committed
chore: Script for automatic version bumping
1 parent 8796caf commit eae9104

File tree

4 files changed

+388
-0
lines changed

4 files changed

+388
-0
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,26 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9393
- **Environment**: Optional PyPI environment configuration for additional security
9494
- **Testing**: Pre-publish testing ensures package integrity before distribution
9595

96+
## [1.0.6] - 2024-12-09
97+
98+
### Security
99+
- **Vulnerability Fixes**: Resolved all security issues identified by Bandit security scanner
100+
- **Safe Serialization**: Replaced pickle with JSON for cache files to prevent deserialization attacks
101+
- **Input Validation**: Added validation for subprocess calls in config editor functionality
102+
- **Authentication**: Fixed test authentication state to prevent environment variable interference
103+
104+
### Fixed
105+
- **Test Suite**: All tests now pass reliably (277/277 passing)
106+
- **Version Display**: Fixed CLI version command to show correct version number
107+
- **Environment Variables**: Improved handling of LINEAR_API_KEY environment variable in tests
108+
- **Cache Security**: Enhanced performance cache with safer JSON-based persistence
109+
110+
### Technical
111+
- **Bandit Compliance**: Addressed all medium and high severity security warnings
112+
- **Test Isolation**: Improved test fixtures to prevent environment variable conflicts
113+
- **Code Quality**: Enhanced error handling with proper logging instead of silent failures
114+
- **Editor Validation**: Added whitelist validation for safe text editors in config command
115+
96116
## [Unreleased]
97117

98118
### Planned Features

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ dev: format lint test ## Format, lint, and test (quick dev workflow)
180180
ci: format-check lint test-cov ## Simulate CI/CD pipeline locally
181181

182182
# Release preparation
183+
prepare-release: ## Prepare release with version bump (usage: make prepare-release VERSION=1.2.3)
184+
@if [ -z "$(VERSION)" ]; then \
185+
echo "$(RED)Error: VERSION is required. Usage: make prepare-release VERSION=1.2.3$(NC)"; \
186+
exit 1; \
187+
fi
188+
@echo "$(GREEN)Preparing release $(VERSION)...$(NC)"
189+
python scripts/prepare_release.py $(VERSION)
190+
183191
release-check: clean ci build docs ## Full release preparation check
184192
@echo "$(GREEN)Release check complete!$(NC)"
185193
@echo "Ready to upload with 'make upload-test' or 'make upload'"

scripts/README.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Scripts
2+
3+
This directory contains utility scripts for Linearator development and release management.
4+
5+
## Release Preparation Script
6+
7+
### `prepare_release.py`
8+
9+
Automates the process of preparing a new release by updating version numbers across the codebase.
10+
11+
#### Usage
12+
13+
```bash
14+
# Basic usage
15+
python scripts/prepare_release.py 1.2.3
16+
17+
# Via Makefile (recommended)
18+
make prepare-release VERSION=1.2.3
19+
20+
# Dry run to see what would change
21+
python scripts/prepare_release.py 1.2.3 --dry-run
22+
23+
# Skip changelog entry
24+
python scripts/prepare_release.py 1.2.3 --no-changelog
25+
```
26+
27+
#### What it does
28+
29+
1. **Validates version format** - Ensures semantic versioning (X.Y.Z)
30+
2. **Updates version in multiple files:**
31+
- `pyproject.toml` - Package version
32+
- `src/linear_cli/__init__.py` - Python module version
33+
- `tests/unit/test_cli_basic.py` - Test version assertion
34+
3. **Creates changelog entry** - Adds new release section to `CHANGELOG.md`
35+
4. **Provides next steps** - Shows what to do after running the script
36+
37+
#### Files Updated
38+
39+
| File | What's Updated |
40+
|------|----------------|
41+
| `pyproject.toml` | `version = "X.Y.Z"` |
42+
| `src/linear_cli/__init__.py` | `__version__ = "X.Y.Z"` |
43+
| `tests/unit/test_cli_basic.py` | Version assertion in tests |
44+
| `CHANGELOG.md` | New release section with template |
45+
46+
#### Example Output
47+
48+
```bash
49+
$ make prepare-release VERSION=1.2.3
50+
51+
🚀 Preparing release 1.2.3
52+
📦 Current version: 1.2.2
53+
✅ Updated version in pyproject.toml
54+
✅ Updated __version__ in src/linear_cli/__init__.py
55+
✅ Updated version assertion in tests/unit/test_cli_basic.py
56+
✅ Added 1.2.3 section to CHANGELOG.md
57+
📝 Please edit CHANGELOG.md to add release notes
58+
59+
🎉 Successfully prepared release 1.2.3!
60+
61+
Next steps:
62+
1. Edit CHANGELOG.md to add release notes
63+
2. Run tests: make test
64+
3. Commit changes: git add . && git commit -m 'chore: prepare release v1.2.3'
65+
4. Create release: git tag v1.2.3 && git push origin v1.2.3
66+
5. Publish GitHub release to trigger PyPI upload
67+
```
68+
69+
#### Complete Release Workflow
70+
71+
1. **Prepare release:**
72+
```bash
73+
make prepare-release VERSION=1.2.3
74+
```
75+
76+
2. **Edit changelog** - Fill in release notes in `CHANGELOG.md`
77+
78+
3. **Run tests:**
79+
```bash
80+
make test
81+
```
82+
83+
4. **Commit and tag:**
84+
```bash
85+
git add .
86+
git commit -m "chore: prepare release v1.2.3"
87+
git tag v1.2.3
88+
git push origin main
89+
git push origin v1.2.3
90+
```
91+
92+
5. **Create GitHub release** - This triggers automated PyPI publishing
93+
94+
#### Error Handling
95+
96+
The script includes comprehensive error handling:
97+
98+
- **Invalid version format** - Must be semantic versioning (X.Y.Z)
99+
- **Missing files** - Warns if expected files aren't found
100+
- **Pattern matching failures** - Reports if version patterns can't be found
101+
- **File write errors** - Handles permission and disk space issues
102+
103+
#### Options
104+
105+
- `--dry-run` - Preview changes without making them
106+
- `--no-changelog` - Skip adding changelog entry
107+
- `--help` - Show usage information
108+
109+
#### Integration
110+
111+
The script is integrated with the project's Makefile for easy usage:
112+
113+
```bash
114+
# Prepare release (will prompt for VERSION if not provided)
115+
make prepare-release VERSION=1.2.3
116+
117+
# Check all release prerequisites
118+
make release-check
119+
```

0 commit comments

Comments
 (0)