Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 45 additions & 7 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- master
tags:
- 'v*.*.*'
- "v*.*.*"

jobs:
build:
Expand All @@ -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
Expand All @@ -29,7 +29,7 @@ jobs:
runs_on: ubuntu-22.04
# DBus configuration
- artifact_type: slim
dbus: ''
dbus: ""
- artifact_type: default
dbus: dbus_mpris
- artifact_type: full
Expand All @@ -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:
Expand Down Expand Up @@ -86,10 +86,30 @@ 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: |
# Map OS/arch to Rust target target_triple
if [ "${{ matrix.target }}" != "" ]; then
# Use the cross-compilation target if specified
TARGET_TRIPLE="${{ matrix.target }}"
elif [ "${{ matrix.os }}" = "linux" ] && [ "${{ matrix.arch }}" = "x86_64" ]; then
TARGET_TRIPLE="x86_64-unknown-linux-gnu"
elif [ "${{ matrix.os }}" = "macos" ] && [ "${{ matrix.arch }}" = "x86_64" ]; then
TARGET_TRIPLE="x86_64-apple-darwin"
elif [ "${{ matrix.os }}" = "macos" ] && [ "${{ matrix.arch }}" = "aarch64" ]; then
TARGET_TRIPLE="aarch64-apple-darwin"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be possible to just use rustc -vV to automatically determine the host target triple?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right, using rustc -vV is cleaner and more reliable. I'll make that change. Thanks for the suggestion.

else
echo "Unknown target: ${{ matrix.os }}-${{ matrix.arch }}"
exit 1
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
Expand All @@ -99,10 +119,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')
Expand All @@ -118,6 +143,8 @@ jobs:
do
pushd $artifact_dir
artifact_name=$(basename $artifact_dir)
# Remove -legacy suffix for old naming format
artifact_name=${artifact_name%-legacy}
tar czvf $artifact_name.tar.gz spotifyd
shasum -a 512 $artifact_name.tar.gz > $artifact_name.sha512
popd
Expand All @@ -128,5 +155,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`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure, but I think the code above will remove -legacy before publishing the release. And probably, if we want to keep a legacy version, this should keep the identical naming as previously.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you’re right, the packaging step removes the -legacy suffix, so legacy artifacts would not retain their original naming and this could lead to confusion or potential naming conflicts. I can remove the artifact_name=${artifact_name%-legacy line so legacy releases keep the -legacy suffix and preserve the previous naming format. Does that approach work for you?


Both formats are available in this release for backwards compatibility.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 40 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[package]
authors = ["Simon Persson <simon@flaskpost.org>", "Sven Lechner <sven.lechner@rwth-aachen.de>", "eladyn <eladyn@protonmail.com>"]
authors = [
"Simon Persson <simon@flaskpost.org>",
"Sven Lechner <sven.lechner@rwth-aachen.de>",
"eladyn <eladyn@protonmail.com>",
]
edition = "2024"
name = "spotifyd"
description = "A Spotify daemon"
Expand All @@ -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 }
Expand All @@ -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"

Expand Down Expand Up @@ -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"],
[
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is rather picky, but maybe we can keep the previous formatting of the Cargo.toml file. :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem at all, I'll revert to the original formatting. Consistency is important.

"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]
Expand All @@ -83,6 +106,17 @@ 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"]

[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
pkg-fmt = "zip"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we provide Windows binaries currently, what does this do?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, you don't currently provide Windows binaries, this is premature optimisation. I added it based on cargo-binstall's support matrix (https://github.com/cargo-bins/cargo-binstall/blob/main/SUPPORT.md), but I'm happy to remove it for now. We can add it back when/if Windows builds are introduced.



[profile.release]
lto = true

Expand Down
43 changes: 38 additions & 5 deletions docs/src/installation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 (Recommended)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, I'd rather not have cargo-binstall be the recommended installation method. Official packages by distributions will probably have better compatibility with the user's system and don't require a working rust / cargo installation...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that makes sense, I’ll remove the “Recommended” wording and position cargo-binstall as an optional convenience method for users who already have Rust/Cargo installed


If you have Rust installed, the easiest way to 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)
Expand Down Expand Up @@ -41,22 +57,39 @@ 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:**
Starting with version 0.4.2, release assets follow Rust's standard target triple naming format:

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`

**Legacy naming:** (deprecated, available only in version 0.4.2 for backwards compatibility)
`spotifyd-linux-x86_64-full-legacy.tar.gz`
`spotifyd-macos-aarch64-default-legacy.tar.gz`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the current version is 0.4.2, this should probably be 0.4.3. (And before we forget to remove it later on, maybe we can just omit this part or at least the one about the legacy naming, what do you think?)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, since this is a one time transition, the version specific documentation and legacy naming section will become outdated quickly. I'll remove those parts to keep the docs cleaner and avoid future maintenance burden. Thanks for thinking ahead on this!


**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)
Expand Down