-
Notifications
You must be signed in to change notification settings - Fork 1
364 lines (315 loc) Β· 13.1 KB
/
release-manual.yml
File metadata and controls
364 lines (315 loc) Β· 13.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
name: Manual Release
on:
workflow_dispatch:
inputs:
release_type:
description: 'Release type'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
- custom
custom_version:
description: 'Custom version (only used if release_type is custom, e.g., 1.16.1)'
required: false
type: string
release_notes:
description: 'Additional release notes (optional)'
required: false
type: string
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
jobs:
prepare-release:
name: Prepare Release
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.version.outputs.new_version }}
release_notes: ${{ steps.notes.outputs.notes }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Determine version
id: version
run: |
# Get current version from Cargo.toml
CURRENT_VERSION=$(grep "^version" Cargo.toml | sed 's/version = "\(.*\)"/\1/')
echo "Current version: $CURRENT_VERSION"
# Parse version components
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION"
# Determine new version based on input
if [ "${{ github.event.inputs.release_type }}" = "custom" ]; then
if [ -z "${{ github.event.inputs.custom_version }}" ]; then
echo "Error: Custom version not provided"
exit 1
fi
NEW_VERSION="${{ github.event.inputs.custom_version }}"
elif [ "${{ github.event.inputs.release_type }}" = "major" ]; then
NEW_VERSION="$((MAJOR + 1)).0.0"
elif [ "${{ github.event.inputs.release_type }}" = "minor" ]; then
NEW_VERSION="$MAJOR.$((MINOR + 1)).0"
else
NEW_VERSION="$MAJOR.$MINOR.$((PATCH + 1))"
fi
echo "New version: $NEW_VERSION"
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Update version in Cargo.toml
run: |
sed -i "s/^version = .*/version = \"${{ steps.version.outputs.new_version }}\"/" Cargo.toml
- name: Generate comprehensive release notes
id: notes
run: |
VERSION="${{ steps.version.outputs.new_version }}"
LAST_TAG=$(git tag --sort=-version:refname | head -n 1 || echo "")
# Get commit statistics
if [ -n "$LAST_TAG" ]; then
# Check if there are any commits since last tag
if git rev-list ${LAST_TAG}..HEAD --count > /dev/null 2>&1 && [ "$(git rev-list --count ${LAST_TAG}..HEAD 2>/dev/null)" -gt 0 ]; then
COMMIT_COUNT=$(git rev-list --count ${LAST_TAG}..HEAD)
FILES_CHANGED=$(git diff --name-only ${LAST_TAG}..HEAD | wc -l)
COMMITS=$(git log ${LAST_TAG}..HEAD --pretty=format:"%H|%s|%b")
else
# No commits since last tag
COMMIT_COUNT="0"
FILES_CHANGED="0"
COMMITS=""
fi
else
COMMIT_COUNT=$(git rev-list --count HEAD 2>/dev/null || echo "0")
FILES_CHANGED=$(git ls-files | wc -l || echo "0")
COMMITS=$(git log --pretty=format:"%H|%s|%b" 2>/dev/null || echo "")
fi
{
echo "# SQL CLI v${VERSION}"
echo ""
echo "**Release Date:** $(date +'%B %d, %Y')"
echo ""
# Add custom notes if provided
if [ -n "${{ github.event.inputs.release_notes }}" ]; then
echo "## π’ Release Notes"
echo ""
echo "${{ github.event.inputs.release_notes }}"
echo ""
fi
# Add statistics
echo "## π Release Overview"
echo "- **Commits in this release:** $COMMIT_COUNT"
echo "- **Files updated:** $FILES_CHANGED"
echo ""
# Detect and highlight features
echo "## β¨ Highlights"
echo ""
# Check for visual enhancements
if echo "$COMMITS" | grep -qi "cell.*render\|visual\|key.*indicator\|fade\|theme"; then
echo "### π¨ Visual Improvements"
if echo "$COMMITS" | grep -qi "key.*indicator"; then
echo "- **Key Press Indicator**: Visual feedback for key presses with fade effects (F12 to toggle)"
fi
if echo "$COMMITS" | grep -qi "cell.*highlight"; then
echo "- **Enhanced Cell Selection**: Multiple rendering modes for better visual feedback"
fi
echo ""
fi
# Check for debugging improvements
if echo "$COMMITS" | grep -qi "debug\|log\|diagnostic"; then
echo "### π Enhanced Debugging"
if echo "$COMMITS" | grep -qi "dual.*log"; then
echo "- **Dual Logging**: Simultaneous file and in-memory logging"
fi
echo "- **Better Diagnostics**: Improved error messages and state dumps"
echo ""
fi
# Check for state management
if echo "$COMMITS" | grep -qi "state.*container\|refactor.*v[0-9]"; then
echo "### ποΈ Architecture Improvements"
echo "- **State Management**: Continued migration to centralized AppStateContainer"
echo "- **Code Quality**: Transaction-like state updates for better consistency"
echo ""
fi
# Check for data integrity
if echo "$COMMITS" | grep -qi "history.*protect\|corrupt\|atomic"; then
echo "### πΎ Data Protection"
echo "- **History Recovery**: Automatic recovery from corrupted files"
echo "- **Atomic Writes**: Safer file operations to prevent data loss"
echo ""
fi
# Traditional categorized changes
echo "## π Changes by Category"
echo ""
# Features
if [ -n "$LAST_TAG" ] && [ "$COMMIT_COUNT" -gt 0 ]; then
FEATURES=$(git log ${LAST_TAG}..HEAD --pretty=format:"%s" 2>/dev/null | grep -E "^feat(\(.*\))?:" | sed 's/^feat[^:]*: //' | grep -v "bump version" || true)
if [ -n "$FEATURES" ]; then
echo "### π New Features"
echo "$FEATURES" | while IFS= read -r line; do
[ -n "$line" ] && echo "- $line"
done
echo ""
fi
# Bug Fixes
FIXES=$(git log ${LAST_TAG}..HEAD --pretty=format:"%s" 2>/dev/null | grep -E "^fix(\(.*\))?:" | sed 's/^fix[^:]*: //' | grep -v "bump version" || true)
if [ -n "$FIXES" ]; then
echo "### π Bug Fixes"
echo "$FIXES" | while IFS= read -r line; do
[ -n "$line" ] && echo "- $line"
done
echo ""
fi
# Refactoring
REFACTORS=$(git log ${LAST_TAG}..HEAD --pretty=format:"%s" 2>/dev/null | grep -E "^refactor(\(.*\))?:" | sed 's/^refactor[^:]*: //' | grep -v "bump version" || true)
if [ -n "$REFACTORS" ]; then
echo "### π§ Refactoring"
echo "$REFACTORS" | while IFS= read -r line; do
[ -n "$line" ] && echo "- $line"
done
echo ""
fi
# Documentation
DOCS=$(git log ${LAST_TAG}..HEAD --pretty=format:"%s" 2>/dev/null | grep -E "^docs(\(.*\))?:" | sed 's/^docs[^:]*: //' | grep -v "bump version" || true)
if [ -n "$DOCS" ]; then
echo "### π Documentation"
echo "$DOCS" | while IFS= read -r line; do
[ -n "$line" ] && echo "- $line"
done
echo ""
fi
fi
# Collapsible full commit list
if [ "$COMMIT_COUNT" -gt 0 ]; then
echo "<details>"
echo "<summary>π View all commits</summary>"
echo ""
if [ -n "$LAST_TAG" ]; then
git log ${LAST_TAG}..HEAD --pretty=format:"- %s (%an)" 2>/dev/null | grep -v "bump version" || true
else
git log --pretty=format:"- %s (%an)" 2>/dev/null | head -20 || true
fi
echo ""
echo "</details>"
fi
echo ""
# Key features section
echo "## π― Key Features"
echo ""
echo "- **Instant Data Preview**: CSV/JSON files load immediately"
echo "- **Visual Feedback**: Key press indicator, cell highlighting"
echo "- **Advanced Navigation**: Vim-style keys, viewport/cursor lock"
echo "- **Powerful Search**: Regular search (Ctrl+F), fuzzy filter (Ctrl+/)"
echo "- **Data Export**: Save as CSV or JSON"
echo "- **Debug Mode**: Press F5 for comprehensive state information"
echo ""
# Installation
echo "## π¦ Installation"
echo ""
echo "Download the binary for your platform from the assets below."
echo ""
echo "---"
echo "**Thank you for using SQL CLI!** π"
echo ""
echo "Report issues: [GitHub Issues](https://github.com/TimelordUK/sql-cli/issues)"
} > RELEASE_NOTES.md
# Save to output
echo "notes<<EOF" >> $GITHUB_OUTPUT
cat RELEASE_NOTES.md >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Commit version bump and release notes
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add Cargo.toml RELEASE_NOTES.md
git commit -m "chore: bump version to v${{ steps.version.outputs.new_version }}"
git push
- name: Create and push tag
run: |
git tag -a "v${{ steps.version.outputs.new_version }}" -m "Release v${{ steps.version.outputs.new_version }}"
git push origin "v${{ steps.version.outputs.new_version }}"
build:
name: Build Release Binaries
needs: prepare-release
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact: sql-cli-linux-x64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact: sql-cli-windows-x64
- os: macos-latest
target: x86_64-apple-darwin
artifact: sql-cli-macos-x64
- os: macos-latest
target: aarch64-apple-darwin
artifact: sql-cli-macos-arm64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
ref: v${{ needs.prepare-release.outputs.new_version }}
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Build Release
run: cargo build --release --target ${{ matrix.target }}
- name: Create artifact directory
run: mkdir -p artifacts
- name: Copy binary (Unix)
if: matrix.os != 'windows-latest'
run: cp target/${{ matrix.target }}/release/sql-cli artifacts/${{ matrix.artifact }}
- name: Copy binary (Windows)
if: matrix.os == 'windows-latest'
run: cp target/${{ matrix.target }}/release/sql-cli.exe artifacts/${{ matrix.artifact }}.exe
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: artifacts/*
publish-crates:
name: Publish to crates.io
needs: [prepare-release, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: v${{ needs.prepare-release.outputs.new_version }}
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
release:
name: Create GitHub Release
needs: [prepare-release, build, publish-crates]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: v${{ needs.prepare-release.outputs.new_version }}
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ needs.prepare-release.outputs.new_version }}
name: v${{ needs.prepare-release.outputs.new_version }}
body: ${{ needs.prepare-release.outputs.release_notes }}
files: artifacts/**/*
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}