home bacground image at 100% height #54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.44.4' | |
| channel: stable | |
| cache: true | |
| pub-cache: false | |
| - name: Cache Pub Dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.pub-cache/hosted | |
| key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pub- | |
| - run: rm -rf ~/.pub-cache/git | |
| - run: flutter pub get | |
| - run: dart run build_runner build --delete-conflicting-outputs | |
| - run: flutter analyze | |
| - run: flutter test | |
| prepare: | |
| needs: validate | |
| if: github.event_name == 'push' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| APP_VERSION: ${{ steps.get_version.outputs.APP_VERSION }} | |
| BUILD_NUMBER: ${{ steps.get_version.outputs.BUILD_NUMBER }} | |
| SKIP_RELEASE: ${{ steps.version_check.outputs.SKIP_RELEASE }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get App Version | |
| id: get_version | |
| run: | | |
| VERSION=$(grep '^version:' pubspec.yaml | awk '{print $2}') | |
| if [ -z "$VERSION" ]; then | |
| echo "ERROR: No version found in pubspec.yaml" | |
| exit 1 | |
| fi | |
| echo "APP_VERSION=$(echo "$VERSION" | cut -d'+' -f1)" >> "$GITHUB_OUTPUT" | |
| echo "BUILD_NUMBER=$(echo "$VERSION" | cut -d'+' -f2)" >> "$GITHUB_OUTPUT" | |
| - name: Check Version Not Already Released | |
| id: version_check | |
| run: | | |
| TAG="v${{ steps.get_version.outputs.APP_VERSION }}+${{ steps.get_version.outputs.BUILD_NUMBER }}" | |
| if git rev-parse "$TAG" >/dev/null 2>&1; then | |
| echo "Tag $TAG already exists. Skipping release." | |
| echo "SKIP_RELEASE=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "SKIP_RELEASE=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| build-android: | |
| needs: [validate, prepare] | |
| if: needs.prepare.outputs.SKIP_RELEASE == 'false' | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.44.4' | |
| channel: stable | |
| cache: true | |
| pub-cache: false | |
| - name: Cache Pub Dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.pub-cache/hosted | |
| key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pub- | |
| - run: rm -rf ~/.pub-cache/git | |
| - run: flutter pub get | |
| - run: dart run build_runner build --delete-conflicting-outputs | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| - name: Setup Android Keystore | |
| run: | | |
| echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > android/app/upload-keystore.jks | |
| echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" > android/key.properties | |
| echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties | |
| echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties | |
| echo "storeFile=upload-keystore.jks" >> android/key.properties | |
| - name: Build Android APK | |
| run: | | |
| flutter build apk --release \ | |
| --build-name=${{ needs.prepare.outputs.APP_VERSION }} \ | |
| --build-number=${{ needs.prepare.outputs.BUILD_NUMBER }} | |
| - name: Upload Android Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: android-apk | |
| path: build/app/outputs/flutter-apk/*.apk | |
| build-linux: | |
| needs: [validate, prepare] | |
| if: needs.prepare.outputs.SKIP_RELEASE == 'false' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: '3.44.4' | |
| channel: stable | |
| cache: true | |
| pub-cache: false | |
| - name: Cache Pub Dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.pub-cache/hosted | |
| key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pub- | |
| - run: rm -rf ~/.pub-cache/git | |
| - run: flutter pub get | |
| - run: dart run build_runner build --delete-conflicting-outputs | |
| - name: Install Linux Build Dependencies | |
| run: | | |
| sudo apt-get update -y | |
| sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev libayatana-appindicator3-dev libmpv-dev | |
| - name: Build Linux | |
| run: flutter build linux --release | |
| - name: Package Linux Bundle | |
| run: | | |
| BUNDLE="build/linux/x64/release/bundle" | |
| OUTDIR="sonora-linux-x64" | |
| mkdir -p "$OUTDIR" | |
| cp -r "$BUNDLE"/* "$OUTDIR/" | |
| cp assets/logo_full.png "$OUTDIR/sonora.png" | |
| cp assets/icons/tray/tray_icon.png "$OUTDIR/tray_icon.png" | |
| if command -v convert &>/dev/null; then | |
| convert "$OUTDIR/tray_icon.png" -resize 48x48 "$OUTDIR/tray_icon.png" | |
| fi | |
| cat > "$OUTDIR/com.gmstyle.sonora.desktop" << 'DESKTOP' | |
| [Desktop Entry] | |
| Name=Sonora | |
| Comment=A music streaming app powered by YouTube Music | |
| Exec=sonora | |
| Icon=/opt/sonora/sonora.png | |
| Terminal=false | |
| Type=Application | |
| Categories=Audio;Music;Player; | |
| StartupWMClass=com.gmstyle.sonora | |
| DESKTOP | |
| cat > "$OUTDIR/install.sh" << 'INSTALL' | |
| #!/bin/bash | |
| set -e | |
| INSTALL_DIR="/opt/sonora" | |
| sudo mkdir -p "$INSTALL_DIR" | |
| sudo cp -r "$(dirname "$0")"/* "$INSTALL_DIR/" | |
| sudo chmod +x "$INSTALL_DIR/sonora" | |
| mkdir -p "$HOME/.local/share/applications" | |
| sed "s|Exec=sonora|Exec=$INSTALL_DIR/sonora|" "$INSTALL_DIR/com.gmstyle.sonora.desktop" > "$HOME/.local/share/applications/com.gmstyle.sonora.desktop" | |
| for SIZE in 48 64 128 256; do | |
| mkdir -p "$HOME/.local/share/icons/hicolor/${SIZE}x${SIZE}/apps" | |
| if command -v convert &>/dev/null; then | |
| convert "$INSTALL_DIR/sonora.png" -resize "${SIZE}x${SIZE}" \ | |
| "$HOME/.local/share/icons/hicolor/${SIZE}x${SIZE}/apps/sonora.png" | |
| else | |
| cp "$INSTALL_DIR/sonora.png" "$HOME/.local/share/icons/hicolor/${SIZE}x${SIZE}/apps/sonora.png" | |
| fi | |
| done | |
| gtk-update-icon-cache "$HOME/.local/share/icons/hicolor/" 2>/dev/null || true | |
| update-desktop-database "$HOME/.local/share/applications/" 2>/dev/null || true | |
| echo "Sonora installed! Run: $INSTALL_DIR/sonora" | |
| INSTALL | |
| cat > "$OUTDIR/uninstall.sh" << 'UNINSTALL' | |
| #!/bin/bash | |
| set -e | |
| INSTALL_DIR="/opt/sonora" | |
| echo "Removing Sonora..." | |
| if [ -d "$INSTALL_DIR" ]; then | |
| sudo rm -rf "$INSTALL_DIR" | |
| fi | |
| rm -f "$HOME/.local/share/applications/com.gmstyle.sonora.desktop" | |
| for SIZE in 48 64 128 256; do | |
| rm -f "$HOME/.local/share/icons/hicolor/${SIZE}x${SIZE}/apps/sonora.png" | |
| done | |
| gtk-update-icon-cache "$HOME/.local/share/icons/hicolor/" 2>/dev/null || true | |
| update-desktop-database "$HOME/.local/share/applications/" 2>/dev/null || true | |
| echo "Sonora uninstalled." | |
| UNINSTALL | |
| chmod +x "$OUTDIR/install.sh" | |
| chmod +x "$OUTDIR/uninstall.sh" | |
| tar czf sonora-linux-x64.tar.gz "$OUTDIR"/ | |
| - name: Install Packaging Dependencies | |
| run: | | |
| sudo apt-get install -y ruby ruby-dev build-essential rpm | |
| sudo gem install fpm | |
| fpm --version | |
| - name: Build Linux DEB + RPM Packages | |
| run: bash packaging/linux/build-packages.sh --format all --skip-build | |
| - name: Upload Linux Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-artifacts | |
| path: | | |
| sonora-linux-x64.tar.gz | |
| build/packages/*.deb | |
| build/packages/*.rpm | |
| create-release: | |
| needs: [prepare, build-android, build-linux] | |
| if: needs.prepare.outputs.SKIP_RELEASE == 'false' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Android Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: android-apk | |
| path: artifacts/ | |
| - name: Download Linux Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: linux-artifacts | |
| path: artifacts/ | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ needs.prepare.outputs.APP_VERSION }}+${{ needs.prepare.outputs.BUILD_NUMBER }} | |
| name: Release v${{ needs.prepare.outputs.APP_VERSION }} (${{ needs.prepare.outputs.BUILD_NUMBER }}) | |
| generate_release_notes: true | |
| body: | | |
| **Version:** ${{ needs.prepare.outputs.APP_VERSION }} | |
| **Build:** ${{ needs.prepare.outputs.BUILD_NUMBER }} | |
| --- | |
| ## Downloads | |
| - **Android APK**: allegato sotto | |
| - **Linux tar.gz** (portable): allegato sotto | |
| - **Linux DEB** (Debian/Ubuntu): allegato sotto | |
| - **Linux RPM** (Fedora/RHEL): allegato sotto | |
| files: | | |
| artifacts/**/*.apk | |
| artifacts/sonora-linux-x64.tar.gz | |
| artifacts/**/*.deb | |
| artifacts/**/*.rpm | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |