Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
19 changes: 19 additions & 0 deletions .github/workflows/check_and_update_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "Periodic check and update of the Cask tap"
on:
schedule:
- cron: "0 */2 * * *"
jobs:
check_and_update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Run updating script
run: ./check_release.sh

- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: "main"
message: "Updated to latest version."
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.tar.gz
27 changes: 27 additions & 0 deletions check_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
RELEASES=('AARCH64_SHA256' 'X64_SHA256')

CURL_RESULT=$(curl -fsL \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/music-assistant/companion/releases) || exit 1
TAG_NAME=$(echo "${CURL_RESULT}" | jq '.[0].tag_name')

VERSION_CUT=$(echo "${TAG_NAME}" | cut -d"v" -f 2) || exit 1
MUSIC_COMPANION_VERSION=$(echo "${VERSION_CUT}" | cut -d"\"" -f 1) || exit 1
export MUSIC_COMPANION_VERSION

for i in "${RELEASES[@]}"
do
ARCH_PART=$(echo "${i}" | cut -f1 -d_) || exit 1
ARCH=$(echo "${ARCH_PART}" | tr '[:upper:]' '[:lower:]') || exit 1
URL="https://github.com/music-assistant/companion/releases/download/v${MUSIC_COMPANION_VERSION}/Music.Assistant.Companion_${ARCH}.app.tar.gz"
curl -sLO "${URL}"

SHA_RESULT=$(shasum -a 256 "Music.Assistant.Companion_${ARCH}.app.tar.gz") || exit 1
SHA_FILE=$(echo "${SHA_RESULT}" | cut -d" " -f 1) || exit 1

export "${i}"="${SHA_FILE}"
done

envsubst <companion.template.rb >Casks/companion.rb
15 changes: 15 additions & 0 deletions companion.template.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cask "companion" do
arch arm: "aarch64", intel: "x64"

version "${MUSIC_COMPANION_VERSION}"
sha256 arm: "${AARCH64_SHA256}",
intel: "${X64_SHA256}"

url "https://github.com/music-assistant/companion/releases/download/v#{version}/Music.Assistant.Companion_#{arch}.app.tar.gz",
verified: "github.com/music-assistant/companion/"
name "Music-Assistant-Companion"
desc "App for music assistant"
homepage "https://music-assistant.github.io/"

app "Music Assistant Companion.app"
end
Loading