From 4c46a50453b4514c6bc5780558cf2f730d329aa2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 25 Oct 2025 22:29:21 +1100 Subject: [PATCH] feat: enhance release note generation and update workflow scripts --- .github/scripts/extract_release_notes.sh | 50 +++++++++ .github/scripts/generate_release_notes.sh | 127 ++++++++++++++++++++++ .github/workflows/publish.yml | 34 ++---- RELEASE_NOTES.md | 52 +++------ 4 files changed, 204 insertions(+), 59 deletions(-) create mode 100755 .github/scripts/extract_release_notes.sh create mode 100755 .github/scripts/generate_release_notes.sh diff --git a/.github/scripts/extract_release_notes.sh b/.github/scripts/extract_release_notes.sh new file mode 100755 index 0000000..bbe73da --- /dev/null +++ b/.github/scripts/extract_release_notes.sh @@ -0,0 +1,50 @@ +#!/bin/bash +set -e + +# Script to extract release notes for a specific version from RELEASE_NOTES.md +# Usage: ./extract_release_notes.sh + +VERSION="$1" + +if [ -z "$VERSION" ]; then + echo "❌ Error: Version argument required" + echo "Usage: $0 " + exit 1 +fi + +echo "Extracting release notes for version $VERSION from RELEASE_NOTES.md" + +# Extract the section for the current version +# Find the line with "# Release Notes - vX.X.X" and extract until the next version or EOF +awk -v ver="$VERSION" ' + BEGIN { found=0; printing=0 } + /^# Release Notes - v/ { + if ($0 ~ ver) { + found=1 + printing=1 + next + } else if (found && printing) { + exit + } + } + printing { print } +' RELEASE_NOTES.md > release_notes.md + +# Check if we found content (should always succeed now) +if [ ! -s release_notes.md ]; then + echo "❌ Error: Could not extract release notes for version $VERSION" + exit 1 +fi + +echo "✅ Successfully extracted release notes for version $VERSION" + +# Append Docker information +echo "---" >> release_notes.md +echo "" >> release_notes.md +echo "### Docker Images" >> release_notes.md +echo "" >> release_notes.md +echo '```bash' >> release_notes.md +echo "docker pull rangermix/twitch-drops-miner:$VERSION" >> release_notes.md +echo '```' >> release_notes.md + +echo "✅ Release notes written to release_notes.md" diff --git a/.github/scripts/generate_release_notes.sh b/.github/scripts/generate_release_notes.sh new file mode 100755 index 0000000..056744d --- /dev/null +++ b/.github/scripts/generate_release_notes.sh @@ -0,0 +1,127 @@ +#!/bin/bash +set -e + +# Script to auto-generate release notes using Gemini AI +# Usage: ./generate_release_notes.sh + +VERSION="$1" +GEMINI_API_KEY="$2" + +if [ -z "$VERSION" ]; then + echo "❌ Error: Version argument required" + echo "Usage: $0 " + exit 1 +fi + +if [ -z "$GEMINI_API_KEY" ]; then + echo "❌ Error: GEMINI_API_KEY argument required" + echo "Usage: $0 " + exit 1 +fi + +# Check if release notes exist for this version +NEEDS_GENERATION=false + +if [ ! -f "RELEASE_NOTES.md" ]; then + echo "RELEASE_NOTES.md not found, will generate" + NEEDS_GENERATION=true +else + # Check if version exists in the file + if ! grep -q "# Release Notes - v$VERSION" RELEASE_NOTES.md; then + echo "Version $VERSION not found in RELEASE_NOTES.md, will generate" + NEEDS_GENERATION=true + fi +fi + +if [ "$NEEDS_GENERATION" = "true" ]; then + echo "🤖 Generating release notes using Gemini AI..." + + # Get commit history since last tag + if ! PREV_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null); then + echo "❌ Error: No git tags found. Something went wrong." + exit 1 + fi + + echo "Previous tag found: $PREV_TAG" + # verify PREV_TAG is semver-like (allow prerelease/build metadata, e.g. v1.2.3-beta.1+exp.sha.5114f85) + if ! [[ "$PREV_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*)?(\+[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)*)?$ ]]; then + echo "❌ Error: Previous tag '$PREV_TAG' is not in semver format (vX.Y.Z)" + exit 1 + fi + echo "Previous tag '$PREV_TAG' is in valid semver format." + COMMITS=$(git log $PREV_TAG..HEAD --pretty=format:"- %s (%h)" | sed 's/"/\\"/g' | sed ':a;N;$!ba;s/\n/\\n/g') + + # Prepare the prompt + PROMPT="You are a technical writer creating user-friendly release notes for Twitch Drops Miner, an application that automatically mines Twitch drops. + + Based on the following git commits, create release notes in this EXACT format: + + # Release Notes - v$VERSION + + [Overall summary of the release in 1-2 sentences, highlighting key improvements and new features.] + + [Organize changes into relevant sections with emojis, such as:] + ### 🌍 [Feature Category Name] + [User-friendly description of the feature, what it does, and why users will like it] + + ### 🎮 [Another Feature Category if applicable] + - **Bold Feature Name**: Description + - **Another Feature**: Description + + ### 🐛 Bug Fixes + - **Issue Description**: What was fixed and how it helps users + - **Another Issue**: Description + + ### 📚 [Other relevant sections] + [Any other improvements worth mentioning, like performance enhancements, UI tweaks, etc.] + + Ensure the notes are clear, concise, yet casual, attractive, and helpful for end-users. Use bullet points and emojis to enhance readability. + + Git commits: + $COMMITS" + + # Call Gemini API + RESPONSE=$(curl -s -X POST \ + "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-09-2025:generateContent?key=$GEMINI_API_KEY" \ + -H "Content-Type: application/json" \ + -d "{ + \"contents\": [{ + \"parts\": [{ + \"text\": $(echo "$PROMPT" | jq -Rs .) + }] + }], + \"generationConfig\": { + \"temperature\": 0.7, + \"maxOutputTokens\": 2048 + } + }") + + # Extract the generated text + GENERATED_NOTES=$(echo "$RESPONSE" | jq -r '.candidates[0].content.parts[0].text // empty') + + if [ -z "$GENERATED_NOTES" ]; then + echo "❌ Error: Failed to generate release notes with Gemini AI" + echo "API Response: $RESPONSE" + exit 1 + fi + + # Write to RELEASE_NOTES.md + if [ -f "RELEASE_NOTES.md" ]; then + # Prepend to existing file + echo -e "$GENERATED_NOTES\n\n$(cat RELEASE_NOTES.md)" > RELEASE_NOTES.md + else + # Create new file + echo "$GENERATED_NOTES" > RELEASE_NOTES.md + fi + + # Commit the generated release notes + # git config user.name "github-actions[bot]" + # git config user.email "github-actions[bot]@users.noreply.github.com" + # git add RELEASE_NOTES.md + # git commit -m "docs: auto-generate release notes for v$VERSION" + # git push origin HEAD + + echo "✅ Generated and committed release notes for v$VERSION" +else + echo "✅ Release notes already exist for v$VERSION" +fi diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6935cb1..2496fac 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -120,6 +120,7 @@ jobs: name: Create GitHub Release runs-on: ubuntu-latest needs: [extract-version, docker-build] + environment: prod steps: - name: Checkout code @@ -140,31 +141,18 @@ jobs: echo "✅ Created and pushed tag v$VERSION" + - name: Auto-generate release notes if missing + run: .github/scripts/generate_release_notes.sh "${{ needs.extract-version.outputs.version }}" "${{ secrets.GEMINI_API_KEY }}" + + - uses: DavidAnson/markdownlint-cli2-action@v20 + with: + fix: true + globs: '**/*.md' + continue-on-error: true + - name: Generate release notes id: release-notes - run: | - VERSION="${{ needs.extract-version.outputs.version }}" - - # Get the previous tag - PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") - - if [ -n "$PREV_TAG" ]; then - echo "## Changes since $PREV_TAG" > release_notes.md - echo "" >> release_notes.md - git log $PREV_TAG..HEAD --pretty=format:"- %s (%h)" >> release_notes.md - else - echo "## Initial Release" > release_notes.md - echo "" >> release_notes.md - echo "First release of Twitch Drops Miner $VERSION" >> release_notes.md - fi - - echo "" >> release_notes.md - echo "" >> release_notes.md - echo "## Docker Images" >> release_notes.md - echo "" >> release_notes.md - echo '```bash' >> release_notes.md - echo "docker pull rangermix/twitch-drops-miner:$VERSION" >> release_notes.md - echo '```' >> release_notes.md + run: .github/scripts/extract_release_notes.sh "${{ needs.extract-version.outputs.version }}" - name: Create GitHub Release uses: softprops/action-gh-release@v2 diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index bcf915b..8378629 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,46 +1,26 @@ # Release Notes - v1.1.0 -## What's New Since vinitial 🎉 +We're excited to roll out v1.1.0, a major update focused entirely on making Twitch Drops Miner accessible to users around the globe by introducing comprehensive internationalization (i18n) support and dynamic language switching. This release also brings crucial bug fixes for stability and cleaner code under the hood. -This is a major release focused on internationalization, stability, and improving the overall user experience by introducing a dedicated web GUI (moving away from the legacy desktop UI). +### 🌍 Global Language Support (i18n) -### 🌍 Global Usability & Localization +This update introduces full multi-language support, allowing you to use the Web GUI in your preferred language without needing a browser translation tool. -We've completely overhauled the application's language support, making the miner accessible to a much wider audience! - -- **Full GUI Translation Support**: Nearly every piece of text in the application is now translatable, providing a seamless experience in your native language. -- **Dynamic Language Switching**: You can now instantly change the display language directly within the web GUI settings without needing to restart the application. -- **New Language Additions**: We've added comprehensive support for 15 new languages: - * Arabic, Czech, Danish, Dutch, French, German, Indonesian, Japanese, Polish, Portuguese, Romanian, Russian, Spanish, Traditional Chinese, and Ukrainian. - -### ✨ User Experience & Interface - -The application has been migrated to a modern, browser-based interface, packed with new visual features. - -- **Dark Mode Theme**: Say goodbye to bright screens! You can now switch to a beautiful **Dark - -# Release Notes - v1.2.0 - -## What's New Since v1.0.0 🎉 - -### 🌍 Instant Language Switching - -You can now change your preferred language without restarting the application! Simply select a new language from the dropdown in the top-right corner, and the entire interface updates immediately. Your language choice is automatically saved and will be remembered the next time you launch the app. - -### 🎮 Enhanced Translation Experience - -- **Native Game Names**: The "Games to Watch" settings now display game names in your selected language, making it easier to find and select your favorite games -- **Complete Interface Translation**: All text throughout the web interface is now properly translated, providing a fully localized experience -- **Better Language Selector**: The language dropdown has been repositioned to the top-right corner of the interface for easier access -- **Improved Text Rendering**: Game names with special characters now display correctly without any formatting issues +- **Dynamic Language Switching**: You can now instantly switch the language of the Web GUI from the settings panel, and the application will update all text immediately without requiring a restart. +- **Comprehensive GUI Translation**: Nearly every piece of text, setting, button, and label in the application now supports native translation, including the specific "Games to Watch" settings. +- **Improved Selector Placement**: The language selector is now conveniently located in the top-right banner area for easy access. ### 🐛 Bug Fixes -- **Persistent Language Settings**: Fixed an issue where your language preference wouldn't save properly between sessions -- **Help Tab Fix**: Resolved a bug that caused help content to appear duplicated when switching languages -- **Error Handling**: Added better error detection and handling for the language selector to prevent crashes -- **Special Characters**: Fixed display problems with game names containing special characters like apostrophes and accents +We squashed several annoying issues to ensure a smoother, more reliable experience, especially when dealing with the new language features. -### 📚 Better Documentation +- **Language Persistence Fixed**: Previously, your selected language might not have saved correctly after closing and reopening the application. Your language setting will now persist across sessions. +- **Special Character Handling**: Fixed an issue where game names containing special characters (like accents or symbols) were not being properly handled or displayed, ensuring accurate drop mining visibility. +- **Help Tab Duplication**: Resolved a bug where switching languages caused content in the Help tab to duplicate, leading to messy, repeated text. -Updated the project documentation to help developers understand and contribute to the translation system more easily. +### 📚 Code Cleanup & Optimization + +While these changes are mostly internal, they result in a faster, more stable application and set the groundwork for future features. + +- **Modernized Translation Engine**: We completely refactored the internal translation system (Translator class) to be faster, cleaner, and easier to maintain. +- **Client Code Cleanup**: Removed unused or legacy code components, including the `ReloadRequest` exception, leading to a lighter, more efficient client application.