Unofficial YouTube Music / Spotify Premium client for Android, built in Liquid Glass. Audio effects, Spotify Connect, listening history, 8 languages. Rust core on librespot.
Kotlin alternativeandroidandroid-applicationclientglassmorphisminnertubelibrespotliquid-glassspotifyspotify-connectspotifyapiyoutube-musicyoutube-playerytdlnis
Builds on GitHub, not only on this Mac
Lelonioebe0c5ec9fde
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.ymlnew file mode 100644index 0000000..a2bda11--- /dev/null+++ b/.github/actions/setup/action.yml@@ -0,0 +1,55 @@+name: Square toolchain+description: >+ Everything a build of Square needs besides the repository: the JDK, the+ Android SDK pieces the Gradle files name, and the Rust toolchain that+ cross-compiles the librespot core. Kept in one place so the build and the+ release cannot drift apart.++runs:+ using: composite+ steps:+ - uses: actions/setup-java@v4+ with:+ distribution: temurin+ java-version: 21++ # The versions app/build.gradle.kts asks for. The NDK is also what+ # cargo-ndk links against, and the build refuses to start without it.+ # Licences are already accepted on GitHub's runners; `yes` is only there+ # in case a new one appears, and is kept from failing the step when+ # sdkmanager stops reading.+ - name: Android SDK packages+ shell: bash+ run: |+ (yes || true) | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install \+ "platforms;android-37.0" \+ "build-tools;36.0.0" \+ "ndk;28.2.13676358" \+ "cmake;3.22.1" > /dev/null++ # rustup is preinstalled at ~/.cargo/bin, which is the cargo the Gradle+ # task looks for first.+ - name: Rust+ shell: bash+ run: |+ rustup toolchain install stable --profile minimal --target aarch64-linux-android+ rustup default stable++ # The Rust core is most of a cold build. Keyed on the lock file and the+ # patched librespot crates, which are the inputs the Gradle task watches.+ - uses: actions/cache@v4+ with:+ path: |+ ~/.cargo/registry/index+ ~/.cargo/registry/cache+ ~/.cargo/git/db+ ~/.cargo/bin/cargo-ndk+ native/target+ key: cargo-${{ runner.os }}-${{ hashFiles('native/Cargo.lock', 'native/vendor/**', 'native/src/**') }}+ restore-keys: cargo-${{ runner.os }}-++ - name: cargo-ndk+ shell: bash+ run: command -v cargo-ndk > /dev/null || cargo install cargo-ndk --version 4.1.2 --locked++ - uses: gradle/actions/setup-gradle@v4diff --git a/.github/workflows/build.yml b/.github/workflows/build.ymlnew file mode 100644index 0000000..368991a--- /dev/null+++ b/.github/workflows/build.yml@@ -0,0 +1,37 @@+name: Build++# Every push to master and every pull request gets an APK, so a change can be+# tried on a phone without building it by hand. No signing secrets here: with+# no keystore the build signs with the debug key, and GitHub does not hand+# secrets to pull requests from forks anyway.+on:+ push:+ branches: [master]+ pull_request:+ workflow_dispatch:++permissions:+ contents: read++concurrency:+ group: build-${{ github.ref }}+ cancel-in-progress: true++jobs:+ apk:+ runs-on: ubuntu-latest+ timeout-minutes: 60+ steps:+ - uses: actions/checkout@v4++ - uses: ./.github/actions/setup++ - name: Build+ run: ./gradlew :app:assembleDev --stacktrace++ - uses: actions/upload-artifact@v4+ with:+ name: square-dev-${{ github.sha }}+ path: app/build/outputs/apk/dev/app-dev.apk+ retention-days: 14+ if-no-files-found: errordiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlnew file mode 100644index 0000000..0aee2a2--- /dev/null+++ b/.github/workflows/release.yml@@ -0,0 +1,99 @@+name: Release++# A tag like v2.2.4 builds the signed APK and leaves it on a draft release.+# The notes are still written by hand, and publishing the draft is still a+# person's decision. Run by hand, it builds and signs the same way but only+# keeps the APK as an artifact, which is how the setup can be tried without+# a release.+on:+ push:+ tags: ['v*']+ workflow_dispatch:++permissions:+ contents: write++concurrency:+ group: release-${{ github.ref }}+ cancel-in-progress: false++jobs:+ apk:+ runs-on: ubuntu-latest+ timeout-minutes: 60+ steps:+ - uses: actions/checkout@v4++ - name: Version+ id: version+ run: |+ version=$(sed -n 's/^ *versionName = "\(.*\)"$/\1/p' app/build.gradle.kts)+ echo "name=$version" >> "$GITHUB_OUTPUT"+ # A tag that says one version over a build that says another would+ # publish an update the app then offers again forever.+ if [ "$GITHUB_REF_TYPE" = tag ] && [ "v$version" != "$GITHUB_REF_NAME" ]; then+ echo "::error::tag $GITHUB_REF_NAME does not match versionName $version"+ exit 1+ fi++ - uses: ./.github/actions/setup++ # The keystore goes to the runner's temporary directory, outside the+ # checkout, and the runner is thrown away when the job ends.+ - name: Signing key+ env:+ KEYSTORE: ${{ secrets.SIGNING_KEYSTORE_BASE64 }}+ STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}+ KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}+ KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}+ run: |+ if [ -z "$KEYSTORE" ] || [ -z "$STORE_PASSWORD" ] || [ -z "$KEY_ALIAS" ] || [ -z "$KEY_PASSWORD" ]; then+ echo "::error::the signing secrets are not set"+ exit 1+ fi+ echo "$KEYSTORE" | base64 --decode > "$RUNNER_TEMP/square-release.jks"+ {+ echo "storeFile=$RUNNER_TEMP/square-release.jks"+ echo "storePassword=$STORE_PASSWORD"+ echo "keyAlias=$KEY_ALIAS"+ echo "keyPassword=$KEY_PASSWORD"+ } > keystore.properties++ - name: Build+ run: ./gradlew :app:assembleRelease --stacktrace++ # Without the right key an update does not install over the app people+ # already have, and the build would not say so: a missing keystore falls+ # back to the debug key. So the certificate is checked against the one+ # every release so far has carried.+ - name: Check the signature+ run: |+ apksigner="$(ls -d "$ANDROID_HOME"/build-tools/* | sort -V | tail -1)/apksigner"+ digest=$("$apksigner" verify --print-certs app/build/outputs/apk/release/app-release.apk \+ | sed -n 's/^Signer #1 certificate SHA-256 digest: //p')+ if [ "$digest" != "9f3469d5049fa93e6b63effd1ad10a1913c9a65b0f7c9a5f2f770cd8ea27cf0c" ]; then+ echo "::error::signed with ${digest:-nothing}, not the release key"+ exit 1+ fi+ cp app/build/outputs/apk/release/app-release.apk "square-${{ steps.version.outputs.name }}.apk"++ - name: Draft release+ if: github.ref_type == 'tag'+ env:+ GH_TOKEN: ${{ github.token }}+ run: |+ apk="square-${{ steps.version.outputs.name }}.apk"+ if gh release view "$GITHUB_REF_NAME" > /dev/null 2>&1; then+ gh release upload "$GITHUB_REF_NAME" "$apk" --clobber+ else+ gh release create "$GITHUB_REF_NAME" "$apk" --draft \+ --title "${{ steps.version.outputs.name }}" --notes ""+ fi++ - uses: actions/upload-artifact@v4+ if: github.ref_type != 'tag'+ with:+ name: square-${{ steps.version.outputs.name }}-signed+ path: square-${{ steps.version.outputs.name }}.apk+ retention-days: 7+ if-no-files-found: error