diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 5508ddda..4560aa61 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -5,7 +5,7 @@ on: branches: - master tags: - - 'v*.*.*' + - "v*.*.*" jobs: build: @@ -16,7 +16,7 @@ jobs: os: [macos, linux] arch: [x86_64, aarch64, armv7] rust: [stable] - artifact_type: ['slim', 'default', 'full'] # The build strategy will build all types for each OS specified + artifact_type: ["slim", "default", "full"] # The build strategy will build all types for each OS specified include: # Runner configuration - os: macos @@ -32,7 +32,7 @@ jobs: runs_on: ubuntu-22.04-arm # DBus configuration - artifact_type: slim - dbus: '' + dbus: "" - artifact_type: default dbus: dbus_mpris - artifact_type: full @@ -56,7 +56,7 @@ jobs: audio_backends: portaudio_backend,rodio_backend exclude: - os: macos - artifact_type: 'full' + artifact_type: "full" - os: macos arch: armv7 steps: @@ -86,10 +86,23 @@ jobs: run: | features="--no-default-features --features ${{ matrix.dbus }},${{ matrix.audio_backends }}" echo CARGO_ARGS="--locked --release $features" | tee -a "$GITHUB_ENV" + - name: Determine target triple + id: target_triple + shell: bash + run: | + # Use the cross-compilation target if specified + if [ "${{ matrix.target}}" != ""]; then + TARGET_TRIPLE="${{ matrix.target }}" + else + # Get the host target from rustc + TARGET_TRIPLE=$(rustc -vV | grep 'host:' | awk '{print $2}') + fi + echo "target_triple=$TARGET_TRIPLE" >> $GITHUB_OUTPUT + echo "Target triple: $TARGET_TRIPLE" - name: Build (using cargo) if: matrix.target == '' run: | - cargo +${{ matrix.rust }} build $CARGO_ARGS + cargo +${{ matrix.rust }} build $CARGO_ARGS - name: Build (using cross) if: matrix.target != '' uses: houseabsolute/actions-rust-cross@v1 @@ -99,10 +112,15 @@ jobs: toolchain: ${{ matrix.rust }} target: ${{ matrix.target }} args: $CARGO_ARGS - - name: Uploading artifacts + - name: Uploading artifacts (new naming) + uses: actions/upload-artifact@v4 + with: + name: spotifyd-${{ steps.target_triple.outputs.target_triple }}-${{ matrix.artifact_type }} + path: target/${{ matrix.target }}/release/spotifyd + - name: Uploading artifacts (legacy naming - deprecated) uses: actions/upload-artifact@v4 with: - name: spotifyd-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.artifact_type }} + name: spotifyd-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.artifact_type }}-legacy path: target/${{ matrix.target }}/release/spotifyd release: # only runs when a version tag is pushed if: startsWith(github.ref, 'refs/tags/v') @@ -128,5 +146,16 @@ jobs: files: | **/*.tar.gz **/*.sha512 + body: | + ## Asset Naming Change + Starting with this release, we're transitioning to Rust's standard target triple naming convention to support `cargo-binstall`. + + **New format:** `spotifyd-{target-triple}-{variant}.tar.gz` + - Example: `spotifyd-x86_64-unknown-linux-gnu-full.tar.gz` + + **Legacy format** (deprecated, will be removed in next release): `spotifyd-{os}-{arch}-{variant}.tar.gz` + - Example: `spotifyd-linux-x86_64-full-legacy.tar.gz` + + Both formats are available in this release for backwards compatibility. env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/Cargo.toml b/Cargo.toml index 25b32407..50b5fb95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,9 @@ [package] -authors = ["Simon Persson ", "Sven Lechner ", "eladyn "] +authors = [ + "Simon Persson ", + "Sven Lechner ", + "eladyn ", +] edition = "2024" name = "spotifyd" description = "A Spotify daemon" @@ -23,7 +27,12 @@ libc = "0.2.82" log = "0.4.6" serde = { version = "1.0.115", features = ["derive"] } sha-1 = "0.10" -tokio = {version = "1.44.2", features = ["signal", "rt-multi-thread", "process", "io-std"] } +tokio = { version = "1.44.2", features = [ + "signal", + "rt-multi-thread", + "process", + "io-std", +] } tokio-stream = "0.1.7" url = "2.2.2" librespot-audio = { version = "0.8.0", default-features = false } @@ -38,7 +47,9 @@ toml = "0.9.8" color-eyre = "0.6" directories = "6.0.0" thiserror = "2.0" -time = { version = "0.3.37", default-features = false, features = ["formatting"] } +time = { version = "0.3.37", default-features = false, features = [ + "formatting", +] } clap = { version = "4.5.23", features = ["derive"] } serde_ignored = "0.1.10" @@ -71,9 +82,21 @@ rodiojack_backend = ["librespot-playback/rodiojack-backend"] depends = "$auto" features = ["pulseaudio_backend", "dbus_mpris"] assets = [ - ["target/release/spotifyd", "usr/bin/", "755"], - ["README.md", "usr/share/doc/spotifyd/README", "644"], - ["contrib/spotifyd.service", "etc/systemd/user/", "644"], + [ + "target/release/spotifyd", + "usr/bin/", + "755", + ], + [ + "README.md", + "usr/share/doc/spotifyd/README", + "644", + ], + [ + "contrib/spotifyd.service", + "etc/systemd/user/", + "644", + ], ] [package.metadata.generate-rpm] @@ -83,6 +106,13 @@ assets = [ { source = "contrib/spotifyd.service", dest = "/etc/systemd/user/spotifyd.service", mode = "644" }, ] +# cargo-binstall support +[package.metadata.binstall] +pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }-full{ archive-suffix }" +bin-dir = "{ bin }{ binary-ext }" +pkg-fmt = "tgz" +disabled-strategies = ["quick-install", "compile"] + [profile.release] lto = true diff --git a/docs/src/installation/README.md b/docs/src/installation/README.md index 89ec672b..3309066c 100644 --- a/docs/src/installation/README.md +++ b/docs/src/installation/README.md @@ -3,6 +3,22 @@ Getting `spotifyd` on your system should be as easy as downloading a binary in most cases. If you'd like to learn how to compile `spotifyd` yourself, head over to [building from source](./source.md). +## Using cargo-binstall (Optional) + +If you have Rust installed, you can quickly install `spotifyd` is using `cargo-binstall` + +```console +cargo binstall spotifyd +``` + +This will automatically download and install the appropriate pre-built binary for your system with all features enabled (`full` variant). + +If you don't have `cargo-binstall` installed yet, you can get it with: + +```console +cargo install cargo-binstall +``` + ## Linux Some linux distributions include `spotifyd` in their official repositories. Have a look at [Repology](https://repology.org/project/spotifyd/versions) @@ -41,22 +57,33 @@ and the platform architecture that they were built for. You can find the latest If you're unsure which version to choose, just go for `default` on desktop systems and `slim` on headless systems. +**Asset Naming Convention:** +Release assets follow Rust's standard target triple naming format: `spotifyd-{target-triple}-{variant}.tar.gz` + +Examples: +`spotifyd-x86_64-unknown-linux-gnu-full.tar.gz` +`spotifyd-aarch64-apple-darwin-default.tar.gz` +`spotifyd-armv7-unknown-linux-gnueabihf-slim.tar.gz` + **Architecture:** If you're on Linux, check your platform architecture with `uname -m`: -- `x86_64`: Download one of the `spotifyd-linux-x86_64-{full,default,slim}.tar.gz` packages. -- `armhf`, `armv7`: Download one of the `spotifyd-linux-armv7-{full,default,slim}.tar.gz` packages. -- `aarch64`: Download one of the `spotifyd-linux-aarch64-{full,default,slim}.tar.gz` +- `x86_64`: Download one of the `spotifyd-x86_64-unknown-linux-gnu-{full,default,slim}.tar.gz` packages. +- `armhf`, `armv7`: Download one of the `spotifyd-armv7-unknown-linux-gnueabihf-{full,default,slim}.tar.gz` packages. +- `aarch64`: Download one of the `spotifyd-aarch64-unknown-linux-gnu-{full,default,slim}.tar.gz` - `armv6`: Unfortunately, we no longer support this architecture. If you still need this to work, please open an issue or join the [community matrix channel](https://matrix.to/#/#spotifyd:matrix.org) and we'll try to find a solution. -If you're on macOS, download one of the `spotifyd-macos-{full,default,slim}.tar.gz` packages. +If you're on macOS: + +- Intel Macs: Download one of the `spotifyd-x86_64-apple-darwin-{default,slim}.tar.gz` packages. + +- Apple Silicon Macs: Download one of the `spotifyd-aarch64-apple-darwin-{default,slim}.tar.gz` packages. You should now extract the downloaded archive, make the `spotifyd` file executable and copy it to a sensible location. This can be done using the following commands: ```console $ tar xzf spotifyd-*.tar.gz # extract -$ cd spotifyd-*/ $ chmod +x spotifyd # make binary executable $ # move to correct location, e.g. on Linux: $ # for a user-wide installation (make sure that your $PATH includes ~/.local/bin) diff --git a/src/dbus_mpris.rs b/src/dbus_mpris.rs index 37679baa..9d10f643 100644 --- a/src/dbus_mpris.rs +++ b/src/dbus_mpris.rs @@ -161,6 +161,7 @@ impl RepeatState { } } + impl From<(bool, bool)> for RepeatState { fn from((context, track): (bool, bool)) -> Self { if context {