-
Notifications
You must be signed in to change notification settings - Fork 6.5k
296 lines (249 loc) · 12.4 KB
/
create-release.yml
File metadata and controls
296 lines (249 loc) · 12.4 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
name: Create Terminal Themes Release
on:
schedule:
- cron: "0 15 * * 1" # Run every Monday at 15:00 UTC
workflow_dispatch: # Allows manual triggering
inputs:
release_name:
description: "Custom release name (optional)"
required: false
default: ""
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up variables
id: vars
run: |
# Generate timestamp-based tag for releases
TIMESTAMP=$(date '+%Y%m%d-%H%M%S')
SHORT_SHA=${GITHUB_SHA::7}
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.release_name }}" ]; then
echo "tag_name=release-$TIMESTAMP-$SHORT_SHA" >> $GITHUB_OUTPUT
echo "release_name=${{ github.event.inputs.release_name }}" >> $GITHUB_OUTPUT
else
echo "tag_name=release-$TIMESTAMP-$SHORT_SHA" >> $GITHUB_OUTPUT
echo "release_name=Terminal Themes - $(date +'%Y%m%d')" >> $GITHUB_OUTPUT
fi
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
echo "timestamp=$TIMESTAMP" >> $GITHUB_OUTPUT
- name: Check for changes since last release
id: changes
run: |
# Find the latest release tag matching your pattern
LAST_TAG=$(git tag --list 'release-*' --sort=-creatordate | head -n 1)
echo "Latest release tag: $LAST_TAG"
# If no previous release, always proceed
if [ -z "$LAST_TAG" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
exit 0
fi
# Check for changes since last release tag, excluding screenshots and backgrounds
CHANGED=$(git diff --name-only "$LAST_TAG"..HEAD | grep -vE '^screenshots/|^backgrounds/' | wc -l)
echo "Changed files count: $CHANGED"
if [ "$CHANGED" -gt 0 ]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Skip release if no changes
if: steps.changes.outputs.changed == 'false'
run: |
echo "No changes since last release. Skipping release."
exit 0
- name: Check for existing release and clean up if needed
run: |
# Delete the 'latest' release and tag if they exist to avoid conflicts
gh release delete latest --yes --cleanup-tag 2>/dev/null || echo "No existing 'latest' release to delete"
# Also clean up old automated releases (keep only the last 5)
echo "Cleaning up old automated releases..."
gh release list --limit 100 --json tagName,createdAt \
| jq -r '.[] | select(.tagName | startswith("release-")) | .tagName' \
| sort -r \
| tail -n +6 \
| head -10 \
| while read -r old_tag; do
if [ -n "$old_tag" ]; then
echo "Deleting old release: $old_tag"
gh release delete "$old_tag" --yes --cleanup-tag 2>/dev/null || echo "Failed to delete $old_tag"
fi
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create release archives
run: |
# Dynamically discover all directories, excluding screenshots and backgrounds
mv schemes iterm2
mv terminal terminal.app
ALL_DIRS=($(find . -maxdepth 1 -type d -name '[a-zA-Z]*' ! -name 'screenshots' ! -name 'backgrounds' ! -name '.*' ! -name 'tools' ! -name 'gh-pages' | sed 's|./||' | sort))
mkdir -p releases
# Create individual archives for each terminal emulator directory
for dir in "${ALL_DIRS[@]}"; do
if [ -d "$dir" ]; then
echo "Creating archive for $dir..."
# Count files to ensure directory is not empty
file_count=$(find "$dir" -type f | wc -l)
if [ $file_count -gt 0 ]; then
# Create tar.gz archive
tar -czf "releases/${dir}-themes.tgz" "$dir"
# Create 7z archive
7z a "releases/${dir}-themes.7z" "$dir"
echo "✓ Created archives for $dir ($file_count files)"
else
echo "⚠️ Skipping empty directory: $dir"
fi
else
echo "⚠️ Directory not found: $dir"
fi
done
# Create a complete archive
echo "Creating complete archive (excluding screenshots and backgrounds)..."
tar -czf "releases/all-terminal-themes.tgz" "${ALL_DIRS[@]}"
7z a "releases/all-terminal-themes.7z" "${ALL_DIRS[@]}"
echo "✓ Created complete archives"
# List created archives
echo "📦 Created archives:"
ls -la releases/
- name: Generate release notes
id: release_notes
run: |
# Generate timestamp-based release notes
cat > release_notes.md << EOF
# Terminal Themes - $(date +'%Y%m%d')
**Commit:** [\`${{ steps.vars.outputs.short_sha }}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})
**Build:** ${{ steps.vars.outputs.timestamp }}
## What's Updated
$(if [ "${{ github.event_name }}" = "push" ]; then
echo "This release was triggered by changes to the following directories:"
echo ""
echo "${{ steps.changes.outputs.changed_dirs }}" | while read -r dir; do
if [ -n "$dir" ] && [ -d "$dir" ]; then
echo "- **$dir** - $(echo $dir | tr '_' ' ' | sed 's/\b\w/\U&/g') themes"
fi
done
echo ""
echo "### Recent Changes"
echo ""
echo "\`\`\`"
git log --oneline -5 --no-merges
echo "\`\`\`"
else
echo "This is a scheduled release containing all available themes."
fi)
## Individual Downloads
Choose the archive for your specific terminal emulator:
### Terminal Emulators
- **alacritty** - Alacritty (https://alacritty.org/)
- **electerm** - Electerm (https://electerm.html5beta.com/)
- **foot** - Foot (https://codeberg.org/dnkl/foot)
- **ghostty** - Ghostty (https://ghostty.org/)
- **iterm2** - iTerm2 (https://iterm2.com/)
- **kitty** - Kitty (https://sw.kovidgoyal.net/kitty/)
- **konsole** - KDE Konsole (https://konsole.kde.org/)
- **lxterminal** - LXTerminal (https://lxde.org/)
- **mobaxterm** - MobaXterm (https://mobaxterm.mobatek.net/)
- **pantheon-terminal** - Pantheon Terminal (https://elementary.io/)
- **putty** - PuTTY (https://www.putty.org/)
- **rio** - Rio (https://rioterm.com/)
- **royalts** - RoyalTS (https://royalts.com/ts/)
- **terminal.app** - macOS Terminal.app (https://support.apple.com/guide/terminal)
- **terminator** - Terminator (https://gnome-terminator.org/)
- **termux** - Termux (https://termux.com/)
- **tilda** - Tilda (https://github.com/lanoxx/tilda)
- **wayst** - Wayst (https://github.com/91861/wayst)
- **wezterm** - WezTerm (https://wezterm.org/)
- **windowsterminal** - Windows Terminal (https://github.com/microsoft/terminal)
- **xfce4terminal** - XFCE Terminal (https://docs.xfce.org/apps/xfce4-terminal/)
### Console
- **freebsd_vt** - FreeBSD VT console color themes
- **linux_console** - Linux console color themes
### Shell
- **dynamic-colors** - OSC4 (shell) dynamic color themes
- **generic** - Universal shell scripts using OSC escape codes
- **iterm-dynamic** - iTerm2 (shell) dynamic color themes
### Formats & Standards
- **yaml** - YAML format color definitions
- **xrdb** - X11 resource database format
- **generic** - Universal shell scripts using OSC escape codes
### Applications & Tools
- **hexchat** - HexChat IRC client (https://hexchat.github.io/)
- **remmina** - Remmina Remote Desktop Client (https://remmina.org/)
- **termframe** - TermFrame (https://terminaltrove.com/termframe/)
- **vhs** - VHS (https://github.com/charmbracelet/vhs)
- **vscode** - Visual Studio Code (https://code.visualstudio.com/)
### Legacy
- **termite** - Termite (https://github.com/thestinger/termite)
## Complete Archive
The `all-terminal-themes` archives contain all terminal emulator formats in a single download (screenshots excluded to reduce size).
## Installation
See the [README](https://github.com/mbadolato/iTerm2-Color-Schemes/blob/master/README.md) for detailed installation instructions for each terminal emulator.
---
**📅 Generated:** $(date '+%Y-%m-%d %H:%M:%S UTC')
**🔗 Commit:** ${{ github.sha }}
**⚡ Auto-release:** This release is automatically generated when terminal emulator folders are updated
**Note:** Screenshots and backgrounds have been excluded from release archives to reduce download size. You can view all color scheme previews in the [screenshots directory](https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/screenshots) on GitHub.
EOF
# Set output for the release notes
{
echo 'notes<<EOF'
cat release_notes.md
echo EOF
} >> $GITHUB_OUTPUT
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.vars.outputs.tag_name }}
name: ${{ steps.vars.outputs.release_name }}
body: ${{ steps.release_notes.outputs.notes }}
files: releases/*
draft: false
prerelease: false
make_latest: true
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload release summary
run: |
echo "## 🎉 Auto-Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Tag:** \`${{ steps.vars.outputs.tag_name }}\`" >> $GITHUB_STEP_SUMMARY
echo "**Release:** ${{ steps.vars.outputs.release_name }}" >> $GITHUB_STEP_SUMMARY
echo "**Commit:** [\`${{ steps.vars.outputs.short_sha }}\`](https://github.com/${{ github.repository }}/commit/${{ github.sha }})" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ github.event_name }}" = "push" ]; then
echo "**Triggered by:** Changes to terminal emulator directories" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Changed directories:**" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "${{ steps.changes.outputs.changed_dirs }}" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
else
echo "**Triggered by:** Manual workflow dispatch" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 📦 Archives Created:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Archive | Size | Type |" >> $GITHUB_STEP_SUMMARY
echo "|---------|------|------|" >> $GITHUB_STEP_SUMMARY
for file in releases/*; do
if [ -f "$file" ]; then
filename=$(basename "$file")
size=$(ls -lh "$file" | awk '{print $5}')
if [[ "$filename" == *".tgz" ]]; then
filetype="tar.gz"
else
filetype="7z"
fi
echo "| $filename | $size | $filetype |" >> $GITHUB_STEP_SUMMARY
fi
done
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 🔗 Release Links" >> $GITHUB_STEP_SUMMARY
echo "- **Release Page:** [View Release](https://github.com/${{ github.repository }}/releases/tag/${{ steps.vars.outputs.tag_name }})" >> $GITHUB_STEP_SUMMARY
echo "- **Latest Release:** [Always Latest](https://github.com/${{ github.repository }}/releases/latest)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ **Auto-release completed successfully!**" >> $GITHUB_STEP_SUMMARY