diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dba1501d..e8fc0707 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,8 +3,6 @@ name: CI on: push: branches: [master] - tags: - - v[0-9]+.* pull_request: branches: [master] @@ -12,24 +10,7 @@ env: CARGO_TERM_COLOR: always jobs: - code-style: - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Setup Cache - uses: Swatinem/rust-cache@v2 - - - name: Install Linux Dependencies - if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get install -y libgtk-3-dev libssl-dev libasound2-dev - - - name: Check Formatting - run: cargo clippy -- -D warnings - - build-and-release: - needs: code-style + build: strategy: fail-fast: false matrix: @@ -46,16 +27,16 @@ jobs: target: x86_64-pc-windows-msvc runs-on: ${{ matrix.os }} - env: - MACOSX_DEPLOYMENT_TARGET: 11.0 steps: - name: Checkout Repository uses: actions/checkout@v4 - - name: Setup Rust Cache - uses: Swatinem/rust-cache@v2 + - name: Install Rust + uses: actions-rs/toolchain@v1 with: - key: ${{ hashFiles('Cross.toml') }} + toolchain: stable + target: ${{ matrix.target }} + override: true - name: Build and Upload Binary uses: taiki-e/upload-rust-binary-action@v1 @@ -63,38 +44,30 @@ jobs: bin: psst-gui target: ${{ matrix.target }} archive: psst-${{ matrix.target }} - include: LICENSE,README.md - tar: ${{ startsWith(matrix.os, 'ubuntu') && 'all' || 'none' }} - zip: ${{ matrix.os == 'windows-latest' && 'all' || 'none' }} - checksum: sha256 - dry-run: ${{ !startsWith(github.ref, 'refs/tags/') }} + tar: unix + zip: windows env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CARGO_PROFILE_RELEASE_LTO: true CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1 - - name: Build for macOS (Universal Binary) + - name: Create Universal Binary (macOS) if: matrix.os == 'macOS-latest' && matrix.target == 'x86_64-apple-darwin' - uses: taiki-e/upload-rust-binary-action@v1 - with: - bin: psst-gui - target: universal-apple-darwin - archive: psst-universal-apple-darwin - include: LICENSE,README.md - checksum: sha256 - dry-run: ${{ !startsWith(github.ref, 'refs/tags/') }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CARGO_PROFILE_RELEASE_LTO: true - CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1 + run: | + lipo -create -output psst-gui-universal \ + ../target/x86_64-apple-darwin/release/psst-gui \ + ../target/aarch64-apple-darwin/release/psst-gui - - name: Create DMG with create-dmg + - name: Create DMG (macOS) if: matrix.os == 'macOS-latest' && matrix.target == 'x86_64-apple-darwin' run: | brew install create-dmg + mkdir -p Psst.app/Contents/MacOS + cp psst-gui-universal Psst.app/Contents/MacOS/psst-gui + cp assets/logo.icns Psst.app/Contents/Resources/ create-dmg \ --volname "Psst" \ - --volicon "psst-gui/assets/logo.icns" \ + --volicon "assets/logo.icns" \ --window-pos 200 120 \ --window-size 600 400 \ --icon-size 100 \ @@ -103,18 +76,18 @@ jobs: --app-drop-link 450 160 \ --no-internet-enable \ "Psst.dmg" \ - "target/release/bundle/osx/Psst.app" + "Psst.app" - - name: Upload macOS DMG - uses: actions/upload-artifact@v4 + - name: Upload DMG if: matrix.os == 'macOS-latest' && matrix.target == 'x86_64-apple-darwin' + uses: actions/upload-artifact@v4 with: name: Psst.dmg path: Psst.dmg deb: + needs: build runs-on: ubuntu-latest - needs: build-and-release strategy: matrix: include: @@ -126,101 +99,41 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - - name: Download Linux Binaries + - name: Download Linux Binary uses: actions/download-artifact@v4 with: - name: psst-gui-${{ matrix.target }} + name: psst-${{ matrix.target }} path: ${{runner.workspace}}/binaries - - name: Move Binary + - name: Extract Binary run: | + tar -xvf ${{runner.workspace}}/binaries/psst-${{ matrix.target }}.tar.gz -C ${{runner.workspace}}/binaries mkdir -p ${{runner.workspace}}/pkg/usr/bin/ mv ${{runner.workspace}}/binaries/psst-gui ${{runner.workspace}}/pkg/usr/bin/ - - name: Move Desktop Entry - run: mkdir -p ${{runner.workspace}}/pkg/usr/share/applications/; mv .pkg/psst.desktop $_ - - - name: Add Icons - run: | - LOGOS=$(cd ./psst-gui/assets/ && ls logo_*.png) - for LOGO in $LOGOS - do - LOGO_SIZE=$(echo "${LOGO}" | grep -oE '[[:digit:]]{2,}') - mkdir -p "${{runner.workspace}}/pkg/usr/share/icons/hicolor/${LOGO_SIZE}x${LOGO_SIZE}/" - cp "./psst-gui/assets/${LOGO}" "$_/psst.png" - done - mkdir -p "${{runner.workspace}}/pkg/usr/share/icons/hicolor/scalable/apps/" - cp "./psst-gui/assets/logo.svg" "$_/psst.svg" - - - name: Set Permissions - run: chmod 755 ${{runner.workspace}}/pkg/usr/bin/psst-gui - - - name: Move License - run: mkdir -p ${{runner.workspace}}/pkg/usr/share/doc/psst-gui/; mv .pkg/copyright $_ - - - name: Move Package Config + - name: Add Metadata and Icons run: | - mkdir -p ${{runner.workspace}}/pkg/ - cp -r .pkg/DEBIAN $_/ - sed -i 's/Architecture: amd64/Architecture: ${{ matrix.arch }}/' ${{runner.workspace}}/pkg/DEBIAN/control - - - name: Set Version - run: "echo Version: $(git rev-list --count HEAD) >> ${{runner.workspace}}/pkg/DEBIAN/control" + mkdir -p ${{runner.workspace}}/pkg/usr/share/applications/ + cp .pkg/psst.desktop $_ + mkdir -p ${{runner.workspace}}/pkg/usr/share/icons/hicolor/ + cp -r psst-gui/assets/logo_*.png $_ + cp psst-gui/assets/logo.svg ${{runner.workspace}}/pkg/usr/share/icons/hicolor/scalable/apps/psst.svg - - name: Build Package + - name: Create Debian Package run: | - cat ${{runner.workspace}}/pkg/DEBIAN/control - dpkg-deb -b ${{runner.workspace}}/pkg/ psst_$(git rev-list --count HEAD)_${{ matrix.arch }}.deb + mkdir -p ${{runner.workspace}}/pkg/DEBIAN + cat << EOF > ${{runner.workspace}}/pkg/DEBIAN/control + Package: psst + Version: $(git rev-list --count HEAD) + Architecture: ${{ matrix.arch }} + Maintainer: Jan Pochyla + Description: Fast Spotify client with native GUI + Small and efficient graphical music player for Spotify network. + EOF + dpkg-deb -b ${{runner.workspace}}/pkg psst_$(git rev-list --count HEAD)_${{ matrix.arch }}.deb - name: Upload Debian Package uses: actions/upload-artifact@v4 with: name: psst-deb-${{ matrix.arch }} path: "*.deb" - - appimage: - if: false # Disable temporarily: https://github.com/jpochyla/psst/actions/runs/3897410142/jobs/6655282029 - runs-on: ubuntu-latest - needs: deb - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Download Debian Package - uses: actions/download-artifact@v4 - with: - name: psst-deb - path: ${{runner.workspace}} - - - name: Install Dependencies - run: sudo apt-get update && sudo apt-get install -y libfuse2 - - - name: Create Workspace - run: mkdir -p ${{runner.workspace}}/appimage - - - name: Download the Latest pkg2appimage - run: | - latest_release_appimage_url=$(wget -q https://api.github.com/repos/AppImageCommunity/pkg2appimage/releases/latest -O - | jq -r '.assets[0].browser_download_url') - wget --directory-prefix=${{runner.workspace}}/appimage -c $latest_release_appimage_url - - - name: Create Path to pkg2appimage - run: | - pkg2appimage_executable=$(ls ${{runner.workspace}}/appimage) - app_path=${{runner.workspace}}/appimage/${pkg2appimage_executable} - chmod +x ${app_path} - echo "app_path=${app_path}" >> $GITHUB_ENV - - - name: Create Path to pkg2appimage's Recipe File - run: | - recipe_path=${{runner.workspace}}/psst/.pkg/APPIMAGE/pkg2appimage-ingredients.yml - echo "recipe_path=${recipe_path}" >> $GITHUB_ENV - - - name: Run pkg2appimage - run: | - ${{env.app_path}} ${{env.recipe_path}} - - - name: Upload AppImage - uses: actions/upload-artifact@v4 - with: - name: psst-appimage - path: ${{runner.workspace}}/out/*.AppImage diff --git a/psst-gui/Cargo.toml b/psst-gui/Cargo.toml index aee5e1e0..89cd1e82 100644 --- a/psst-gui/Cargo.toml +++ b/psst-gui/Cargo.toml @@ -6,6 +6,7 @@ edition = "2021" build = "build.rs" description = "Fast Spotify client with native GUI" repository = "https://github.com/jpochyla/psst" +license = "MIT" # Add this if you haven't specified a license [features] default = ["cpal"] @@ -69,3 +70,17 @@ short_description = "Fast Spotify client with native GUI" long_description = """ Small and efficient graphical music player for Spotify network. """ + +# Add this section for deb packaging +[package.metadata.deb] +maintainer = "Jan Pochyla " +copyright = "2024, Jan Pochyla " +license-file = ["LICENSE", "4"] +depends = "$auto" +section = "sound" +priority = "optional" +assets = [ + ["target/release/psst-gui", "usr/bin/", "755"], + ["assets/logo.svg", "usr/share/icons/hicolor/scalable/apps/psst.svg", "644"], + [".pkg/psst.desktop", "usr/share/applications/", "644"], +] \ No newline at end of file