|
| 1 | +name: Create Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ main ] |
| 6 | + paths: |
| 7 | + - 'version' |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + pull-requests: write |
| 12 | + issues: write |
| 13 | + |
| 14 | +jobs: |
| 15 | + create-release: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout code |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + fetch-depth: 2 |
| 22 | + |
| 23 | + - name: Check if version file changed |
| 24 | + id: check |
| 25 | + run: | |
| 26 | + if git diff HEAD~1 HEAD --name-only | grep -q "^version$"; then |
| 27 | + echo "changed=true" >> $GITHUB_OUTPUT |
| 28 | + echo "Version file has changed" |
| 29 | + else |
| 30 | + echo "changed=false" >> $GITHUB_OUTPUT |
| 31 | + echo "Version file has not changed" |
| 32 | + fi |
| 33 | + |
| 34 | + - name: Read version |
| 35 | + id: version |
| 36 | + if: steps.check.outputs.changed == 'true' |
| 37 | + run: | |
| 38 | + VERSION=$(cat version | tr -d '\n') |
| 39 | + echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 40 | + echo "Creating release for version: $VERSION" |
| 41 | + |
| 42 | + - name: Generate changelog |
| 43 | + id: changelog |
| 44 | + if: steps.check.outputs.changed == 'true' |
| 45 | + run: | |
| 46 | + VERSION="${{ steps.version.outputs.version }}" |
| 47 | + |
| 48 | + # Create a comprehensive changelog based on recent commits and version |
| 49 | + case "$VERSION" in |
| 50 | + "v1.1.0") |
| 51 | + CHANGELOG=$(cat << 'EOF' |
| 52 | + ## 🚀 Raspberry Pi OLED System Info Display v1.1.0 - Enhanced Monitoring |
| 53 | + |
| 54 | + This release introduces enhanced system monitoring capabilities and improved display functionality for Raspberry Pi devices. |
| 55 | + |
| 56 | + ### ✨ New Features |
| 57 | + |
| 58 | + - **📊 Comprehensive System Monitoring**: Real-time display of IP Address, CPU Usage, CPU Temperature, RAM Usage, and Current Time |
| 59 | + - **🔄 Auto-Start Service**: Configured as systemd service for automatic startup on boot |
| 60 | + - **⚡ Optimized Refresh Rate**: Updates every 5 seconds for real-time monitoring |
| 61 | + - **🖥️ OLED Display Support**: Full support for 128x32 I2C OLED displays (SSD1306) |
| 62 | + - **🐍 Virtual Environment**: Proper Python dependency management with isolated environment |
| 63 | + - **🏗️ I2C Communication**: Reliable communication with I2C-based OLED displays |
| 64 | + |
| 65 | + ### 🔧 Technical Improvements |
| 66 | + |
| 67 | + - **⚡ Performance Optimization**: Efficient system resource monitoring |
| 68 | + - **🛡️ Error Handling**: Robust error handling and recovery mechanisms |
| 69 | + - **📱 Display Optimization**: Optimized text rendering for 128x32 OLED screens |
| 70 | + - **🔧 System Integration**: Seamless integration with Raspberry Pi GPIO and I2C |
| 71 | + - **📊 Resource Management**: Efficient CPU and memory usage monitoring |
| 72 | + |
| 73 | + ### 🔌 Hardware Compatibility |
| 74 | + |
| 75 | + - **🥧 Raspberry Pi Support**: Compatible with all Raspberry Pi models with I2C support |
| 76 | + - **📺 OLED Display**: Supports 128x32 I2C OLED displays (SSD1306 chipset) |
| 77 | + - **🔌 Simple Wiring**: Easy connection with standard jumper wires |
| 78 | + - **⚡ Low Power**: Minimal power consumption for continuous operation |
| 79 | + |
| 80 | + ### 🔄 Installation & Setup |
| 81 | + |
| 82 | + - **📦 Easy Installation**: Simple setup process with automated service configuration |
| 83 | + - **🔧 Systemd Service**: Automatic startup and management as system service |
| 84 | + - **🐍 Python Environment**: Isolated virtual environment for clean dependency management |
| 85 | + - **📖 Documentation**: Comprehensive setup and installation guide |
| 86 | + |
| 87 | + ### 🛠️ Usage |
| 88 | + |
| 89 | + **Quick Start:** |
| 90 | + 1. Connect your 128x32 I2C OLED display to your Raspberry Pi |
| 91 | + 2. Install the required dependencies |
| 92 | + 3. Configure the systemd service |
| 93 | + 4. Enjoy real-time system information on your OLED display! |
| 94 | + |
| 95 | + ### 🙏 Acknowledgments |
| 96 | + |
| 97 | + This release provides a complete solution for real-time system monitoring on Raspberry Pi devices with OLED displays. |
| 98 | + |
| 99 | + --- |
| 100 | + |
| 101 | + **Full Changelog**: [View all changes](https://github.com/TheInfamousToTo/Pi-HAT-INFO/compare/v1.0.0...v1.1.0) |
| 102 | + EOF |
| 103 | + ) |
| 104 | + ;; |
| 105 | + *) |
| 106 | + # Generic changelog for other versions |
| 107 | + CHANGELOG="## Release $VERSION |
| 108 | +
|
| 109 | + Automatically generated release from version file update. |
| 110 | +
|
| 111 | + See commit history for detailed changes. |
| 112 | + |
| 113 | + **Full Changelog**: [View all changes](https://github.com/TheInfamousToTo/Pi-HAT-INFO/commits/$VERSION)" |
| 114 | + ;; |
| 115 | + esac |
| 116 | + |
| 117 | + # Save changelog to output (GitHub Actions multiline string) |
| 118 | + echo "changelog<<EOF" >> $GITHUB_OUTPUT |
| 119 | + echo "$CHANGELOG" >> $GITHUB_OUTPUT |
| 120 | + echo "EOF" >> $GITHUB_OUTPUT |
| 121 | + |
| 122 | + - name: Check if tag exists |
| 123 | + id: check-tag |
| 124 | + if: steps.check.outputs.changed == 'true' |
| 125 | + run: | |
| 126 | + VERSION="${{ steps.version.outputs.version }}" |
| 127 | + if git tag -l | grep -q "^$VERSION$"; then |
| 128 | + echo "exists=true" >> $GITHUB_OUTPUT |
| 129 | + echo "Tag $VERSION already exists" |
| 130 | + else |
| 131 | + echo "exists=false" >> $GITHUB_OUTPUT |
| 132 | + echo "Tag $VERSION does not exist" |
| 133 | + fi |
| 134 | + |
| 135 | + - name: Create GitHub Release |
| 136 | + if: steps.check.outputs.changed == 'true' && steps.check-tag.outputs.exists == 'false' |
| 137 | + uses: softprops/action-gh-release@v1 |
| 138 | + with: |
| 139 | + tag_name: ${{ steps.version.outputs.version }} |
| 140 | + name: "Pi HAT INFO ${{ steps.version.outputs.version }}" |
| 141 | + body: ${{ steps.changelog.outputs.changelog }} |
| 142 | + draft: false |
| 143 | + prerelease: false |
| 144 | + env: |
| 145 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments