some shit

cf451d9 · gmorell · 2025-07-25 16:16

5 files +343 -17

Files changed

modified .github/workflows/rust-ci.yml
+1 −15
@@ -208,17 +208,10 @@ jobs:
208 208
209 209 - name: Create release notes
210 210 run: |
211 − echo "# Git Friends Release ${GITHUB_REF_NAME}" > release_notes.md
211 + echo "# MarkPrompter Release ${GITHUB_REF_NAME}" > release_notes.md
212 212 echo "" >> release_notes.md
213 213 echo "## Changes in this release" >> release_notes.md
214 214 echo "" >> release_notes.md
215 − echo "This release includes the following binaries:" >> release_notes.md
216 − echo "" >> release_notes.md
217 − echo "- \`gf-hook\`: Git hook for commit message enhancement" >> release_notes.md
218 − echo "- \`gf-server\`: Main Git Friends server" >> release_notes.md
219 − echo "- \`gf-irc\`: IRC client component" >> release_notes.md
220 − echo "- \`gf-tester\`: Testing and validation tool" >> release_notes.md
221 − echo "" >> release_notes.md
222 215 echo "## Supported Platforms" >> release_notes.md
223 216 echo "" >> release_notes.md
224 217 echo "- Linux (x86_64)" >> release_notes.md
@@ -231,14 +224,7 @@ jobs:
231 224 echo "1. Download the appropriate archive for your platform" >> release_notes.md
232 225 echo "2. Extract the binaries" >> release_notes.md
233 226 echo "3. Place them in your PATH" >> release_notes.md
234 − echo "4. Configure \`git-friends.toml\` as needed" >> release_notes.md
235 − echo "" >> release_notes.md
236 − echo "## Docker Image" >> release_notes.md
237 227 echo "" >> release_notes.md
238 − echo "A Docker image is also available at:" >> release_notes.md
239 − echo "\`\`\`" >> release_notes.md
240 − echo "ghcr.io/${{ github.repository }}:${GITHUB_REF_NAME}" >> release_notes.md
241 − echo "\`\`\`" >> release_notes.md
242 228
243 229 - name: Create GitHub Release
244 230 uses: softprops/action-gh-release@v1
modified README.md
+9 −2
@@ -76,8 +76,15 @@ A professional Rust-based markdown teleprompter with automatic scrolling, live p
76 76 ## Building
77 77
78 78 ### Prerequisites
79 −- Rust 1.70 or later
80 −- Cargo package manager
79 +- MSRV: Rust 1.86
80 +
81 +### Required Packages
82 +
83 +## RPM
84 +gtk3-devel gdk-pixbuf-devel pango-devel
85 +
86 +## DEB
87 +gtk3-dev gdk-pixbuf-dev pango-dev
81 88
82 89 ### Build Commands
83 90
added release.sh
+333 −0
@@ -0,0 +1,333 @@
1 +#!/bin/bash
2 +
3 +# NEIAM Release Script
4 +# This script helps create and manage releases for the NEIAM projects
5 +
6 +set -euo pipefail
7 +
8 +# Colors for output
9 +RED='\033[0;31m'
10 +GREEN='\033[0;32m'
11 +YELLOW='\033[1;33m'
12 +BLUE='\033[0;34m'
13 +NC='\033[0m' # No Color
14 +
15 +# Function to print colored output
16 +print_status() {
17 + local color=$1
18 + local message=$2
19 + echo -e "${color}${message}${NC}"
20 +}
21 +
22 +# Function to get current version from Cargo.toml
23 +get_current_version() {
24 + grep '^version = ' Cargo.toml | cut -d'"' -f2
25 +}
26 +
27 +# Function to validate version format
28 +validate_version() {
29 + local version=$1
30 + if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then
31 + print_status $RED "Invalid version format: $version"
32 + print_status $YELLOW "Version should be in format: X.Y.Z or X.Y.Z-suffix"
33 + return 1
34 + fi
35 +}
36 +
37 +# Function to update version in Cargo.toml
38 +update_version() {
39 + local new_version=$1
40 + print_status $BLUE "Updating version to $new_version in Cargo.toml..."
41 + sed -i "s/^version = \".*\"/version = \"$new_version\"/" Cargo.toml
42 + print_status $GREEN "Version updated successfully!"
43 +}
44 +
45 +# Function to create git tag
46 +create_tag() {
47 + local version=$1
48 + local tag_name="v$version"
49 +
50 + print_status $BLUE "Creating git tag $tag_name..."
51 +
52 + # Check if tag already exists
53 + if git tag -l | grep -q "^$tag_name$"; then
54 + print_status $RED "Tag $tag_name already exists!"
55 + return 1
56 + fi
57 +
58 + # Create annotated tag
59 + git tag -a "$tag_name" -m "Release $tag_name"
60 + print_status $GREEN "Tag $tag_name created successfully!"
61 +}
62 +
63 +# Function to show release preparation checklist
64 +show_checklist() {
65 + print_status $BLUE "Pre-release Checklist:"
66 + echo
67 + echo " [ ] All tests are passing"
68 + echo " [ ] Documentation is up to date"
69 + echo " [ ] CHANGELOG.md is updated (if exists)"
70 + echo " [ ] All changes are committed"
71 + echo " [ ] Working directory is clean"
72 + echo " [ ] On the correct branch (usually master/main)"
73 + echo
74 +}
75 +
76 +# Function to check working directory
77 +check_working_directory() {
78 + if [[ -n $(git status --porcelain) ]]; then
79 + print_status $RED "Working directory is not clean!"
80 + print_status $YELLOW "Please commit or stash your changes first."
81 + git status --short
82 + return 1
83 + fi
84 +}
85 +
86 +# Function to check current branch
87 +check_branch() {
88 + local current_branch=$(git branch --show-current)
89 + if [[ $current_branch != "master" && $current_branch != "main" ]]; then
90 + print_status $YELLOW "Warning: You are on branch '$current_branch', not on master/main"
91 + read -p "Do you want to continue? (y/N): " -n 1 -r
92 + echo
93 + if [[ ! $REPLY =~ ^[Yy]$ ]]; then
94 + print_status $RED "Release cancelled."
95 + return 1
96 + fi
97 + fi
98 +}
99 +
100 +# Function to run tests
101 +run_tests() {
102 + print_status $BLUE "Running tests..."
103 + if cargo test; then
104 + print_status $GREEN "All tests passed!"
105 + else
106 + print_status $RED "Tests failed! Please fix issues before releasing."
107 + return 1
108 + fi
109 +}
110 +
111 +# Function to build project
112 +build_project() {
113 + print_status $BLUE "Building project..."
114 + if cargo build --release; then
115 + print_status $GREEN "Build successful!"
116 + else
117 + print_status $RED "Build failed! Please fix issues before releasing."
118 + return 1
119 + fi
120 +}
121 +
122 +# Function to push release
123 +push_release() {
124 + local version=$1
125 + local tag_name="v$version"
126 +
127 + print_status $BLUE "Pushing release to GitHub..."
128 +
129 + # Push commits
130 + git push origin
131 +
132 + # Push tag
133 + git push origin "$tag_name"
134 +
135 + print_status $GREEN "Release pushed successfully!"
136 + print_status $BLUE "GitHub Actions will now build and create the release."
137 + print_status $BLUE "Check the Actions tab in your GitHub repository for progress."
138 +}
139 +
140 +# Function to show help
141 +show_help() {
142 + cat << EOF
143 +NEIAM Release Script
144 +
145 +Usage: $0 <command> [options]
146 +
147 +Commands:
148 + current Show current version
149 + prepare <version> Prepare a new release (update version, create tag)
150 + patch Increment patch version and prepare release
151 + minor Increment minor version and prepare release
152 + major Increment major version and prepare release
153 + push <version> Push release tag to trigger GitHub Actions
154 + checklist Show pre-release checklist
155 + help Show this help message
156 +
157 +Options:
158 + --dry-run Show what would be done without making changes
159 + --no-tests Skip running tests
160 + --no-build Skip building project
161 +
162 +Examples:
163 + $0 current # Show current version
164 + $0 prepare 1.2.3 # Prepare version 1.2.3
165 + $0 patch # Increment patch version (1.2.3 -> 1.2.4)
166 + $0 minor # Increment minor version (1.2.3 -> 1.3.0)
167 + $0 major # Increment major version (1.2.3 -> 2.0.0)
168 + $0 push 1.2.3 # Push v1.2.3 tag to trigger release
169 + $0 prepare 1.2.3 --dry-run # Show what would be done
170 +
171 +Release Process:
172 + 1. Run '$0 checklist' to review pre-release requirements
173 + 2. Run '$0 prepare <version>' to update version and create tag
174 + 3. Run '$0 push <version>' to push and trigger GitHub Actions release
175 +
176 + Or use shortcuts:
177 + - '$0 patch' for patch releases
178 + - '$0 minor' for minor releases
179 + - '$0 major' for major releases
180 +EOF
181 +}
182 +
183 +# Function to increment version
184 +increment_version() {
185 + local current_version=$(get_current_version)
186 + local increment_type=$1
187 +
188 + IFS='.' read -r major minor patch <<< "$current_version"
189 +
190 + case $increment_type in
191 + "patch")
192 + patch=$((patch + 1))
193 + ;;
194 + "minor")
195 + minor=$((minor + 1))
196 + patch=0
197 + ;;
198 + "major")
199 + major=$((major + 1))
200 + minor=0
201 + patch=0
202 + ;;
203 + esac
204 +
205 + echo "$major.$minor.$patch"
206 +}
207 +
208 +# Main function
209 +main() {
210 + local command=${1:-help}
211 + local dry_run=false
212 + local no_tests=false
213 + local no_build=false
214 +
215 + # Parse options
216 + while [[ $# -gt 0 ]]; do
217 + case $1 in
218 + --dry-run)
219 + dry_run=true
220 + shift
221 + ;;
222 + --no-tests)
223 + no_tests=true
224 + shift
225 + ;;
226 + --no-build)
227 + no_build=true
228 + shift
229 + ;;
230 + -*)
231 + print_status $RED "Unknown option: $1"
232 + show_help
233 + exit 1
234 + ;;
235 + *)
236 + break
237 + ;;
238 + esac
239 + done
240 +
241 + case $command in
242 + "current")
243 + local current_version=$(get_current_version)
244 + print_status $BLUE "Current version: $current_version"
245 + ;;
246 + "prepare")
247 + local version=${2:-}
248 + if [[ -z $version ]]; then
249 + print_status $RED "Version is required for prepare command"
250 + show_help
251 + exit 1
252 + fi
253 +
254 + validate_version "$version"
255 +
256 + if [[ $dry_run == true ]]; then
257 + print_status $YELLOW "DRY RUN: Would update version to $version and create tag v$version"
258 + exit 0
259 + fi
260 +
261 + check_working_directory
262 + check_branch
263 +
264 + if [[ $no_tests == false ]]; then
265 + run_tests
266 + fi
267 +
268 + if [[ $no_build == false ]]; then
269 + build_project
270 + fi
271 +
272 + update_version "$version"
273 +
274 + # Commit version change
275 + git add Cargo.toml
276 + git commit -m "Bump version to $version"
277 +
278 + create_tag "$version"
279 +
280 + print_status $GREEN "Release $version prepared successfully!"
281 + print_status $BLUE "Run '$0 push $version' to push and trigger GitHub Actions release"
282 + ;;
283 + "patch"|"minor"|"major")
284 + local new_version=$(increment_version "$command")
285 + print_status $BLUE "Incrementing $command version to $new_version"
286 +
287 + if [[ $dry_run == true ]]; then
288 + print_status $YELLOW "DRY RUN: Would increment $command version to $new_version"
289 + exit 0
290 + fi
291 +
292 + # Call prepare with the new version
293 + main "prepare" "$new_version"
294 + ;;
295 + "push")
296 + local version=${2:-}
297 + if [[ -z $version ]]; then
298 + print_status $RED "Version is required for push command"
299 + show_help
300 + exit 1
301 + fi
302 +
303 + validate_version "$version"
304 +
305 + if [[ $dry_run == true ]]; then
306 + print_status $YELLOW "DRY RUN: Would push tag v$version"
307 + exit 0
308 + fi
309 +
310 + push_release "$version"
311 + ;;
312 + "checklist")
313 + show_checklist
314 + ;;
315 + "help"|*)
316 + show_help
317 + ;;
318 + esac
319 +}
320 +
321 +# Check if we're in a git repository
322 +if ! git rev-parse --git-dir > /dev/null 2>&1; then
323 + print_status $RED "This script must be run from within a git repository"
324 + exit 1
325 +fi
326 +
327 +# Check if Cargo.toml exists
328 +if [[ ! -f Cargo.toml ]]; then
329 + print_status $RED "Cargo.toml not found. This script must be run from the project root."
330 + exit 1
331 +fi
332 +
333 +main "$@"

Parents: e638711