0
0
mirror of https://github.com/cucumber-sp/yandex-music-linux.git synced 2024-12-24 14:34:39 +03:00

Merge branch 'dev'

This commit is contained in:
Andrey Onishchenko 2024-03-14 14:03:47 +03:00
commit 65782781ba
10 changed files with 129 additions and 87 deletions

View File

@ -10,9 +10,6 @@ on:
pull_request: pull_request:
branches: branches:
- '*' - '*'
push:
branches:
- 'dev'
jobs: jobs:
@ -22,7 +19,7 @@ jobs:
image: archlinux:latest image: archlinux:latest
steps: steps:
- name: Install packages - name: Install packages
run: pacman -Syy --noconfirm && pacman -S --noconfirm git sudo base-devel p7zip nodejs jq asar electron27 libpulse dpkg unzip xdg-utils python rpm-tools run: pacman -Syy -q --noconfirm && pacman -S -q --noconfirm git sudo base-devel p7zip nodejs jq asar electron29 libpulse dpkg unzip xdg-utils python rpm-tools
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:

View File

@ -1,13 +0,0 @@
#!/bin/bash
set -e
# get version
VERSION=$(jq -r '.ym.version' ./utility/version_info.json)
release_name="Beta $VERSION"
tag_name="v$VERSION"
#write variables to github env
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "release_name=$release_name" >> $GITHUB_ENV
echo "tag_name=$tag_name" >> $GITHUB_ENV

View File

@ -7,6 +7,7 @@ on:
push: push:
branches: branches:
- 'master' - 'master'
- 'dev'
jobs: jobs:
@ -15,36 +16,80 @@ jobs:
container: container:
image: archlinux:latest image: archlinux:latest
steps: steps:
- name: Packages install
run: pacman -Syy --noconfirm && pacman -S --noconfirm git jq nix python python-requests - name: Install dependencies
run: pacman -Syy -q --noconfirm && pacman -S -q --noconfirm git jq nix python python-requests
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Fix git access - name: Git Access Fix
run: run: git config --global --add safe.directory "*"
git config --global --add safe.directory "*"
- name: Update version file
run: python utility/update_version.py
- name: Update package files - name: Update package files
run: python utility/generate_packages.py run: |
python utility/update_version.py
- name: Retrieve version to make commit python utility/generate_packages.py
run: bash .github/workflows/retrieve_version.sh
- name: Commit and push changes - name: Commit and push changes
uses: EndBug/add-and-commit@v9.1.4 uses: EndBug/add-and-commit@v9.1.4
id: commit id: commit
with: with:
message: "Update packages to ${{ env.release_name }}" message: Update packages
add: "." add: "."
author_name: "GitHub Actions" author_name: GitHub Actions
author_email: "loraner123@gmail.com" author_email: loraner123@gmail.com"
- name: Get Version
id: version
run: |
VERSION=$(jq -r '.ym.version' ./utility/version_info.json)
release_name="Beta $VERSION"
tag_name="v$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "release_name=$release_name" >> $GITHUB_OUTPUT
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
- name: Outputs
id: outputs
run: |
echo "commited=${{ steps.commit.outputs.commited || github.event.head_commit }}" >> $GITHUB_OUTPUT
echo "commit_long_sha=${{ steps.commit.outputs.commit_long_sha || github.event.head_commit.id}}" >> $GITHUB_OUTPUT
echo "commit_name=${{ github.event.head_commit.message || 'Update packages' }}" >> $GITHUB_OUTPUT
echo "tag_name=${{ steps.version.outputs.tag_name }}" >> $GITHUB_OUTPUT
echo "release_name=${{ steps.version.outputs.release_name }}" >> $GITHUB_OUTPUT
echo "VERSION=${{ steps.version.outputs.VERSION }}" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
outputs:
commited: ${{ steps.outputs.commited != '' }}
commit_long_sha: ${{ steps.outputs.commit_long_sha }}
commit_name: ${{ steps.outputs.commit_name }}
tag_name: ${{ steps.outputs.tag_name }}
release_name: ${{ steps.outputs.release_name }}
version: ${{ steps.outputs.VERSION }}
build:
needs: [update_packages]
uses: ./.github/workflows/build.yml
if: ${{ needs.update_packages.outputs.commited }}
with:
ref: ${{ needs.update_packages.outputs.commit_long_sha }}
upload-release:
needs: [build, update_packages]
if: ${{ needs.update_packages.outputs.commited && github.ref_name == 'main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ needs.update_packages.outputs.commit_long_sha }}
- name: Publish package changes to AUR - name: Publish package changes to AUR
if: "${{ github.event.commits[0] || steps.commit.outputs.commited }}"
uses: KSXGitHub/github-actions-deploy-aur@v2.7.0 uses: KSXGitHub/github-actions-deploy-aur@v2.7.0
with: with:
pkgname: "yandex-music" pkgname: "yandex-music"
@ -54,49 +99,30 @@ jobs:
commit_username: "cucumber-sp" commit_username: "cucumber-sp"
commit_email: "loraner123@gmail.com" commit_email: "loraner123@gmail.com"
ssh_private_key: "${{ secrets.AUR_SSH_PRIVATE_KEY }}" ssh_private_key: "${{ secrets.AUR_SSH_PRIVATE_KEY }}"
commit_message: "${{ github.event.commits[0].message || env.release_name }}" commit_message: "${{ needs.update_packages.outputs.commit_name }}"
ssh_keyscan_types: "rsa,dsa,ecdsa,ed25519" ssh_keyscan_types: "rsa,dsa,ecdsa,ed25519"
outputs:
new_version: ${{ steps.commit.outputs.commited }}
commit_long_sha: ${{ steps.commit.outputs.commit_long_sha }}
build:
needs: update_packages
uses: ./.github/workflows/build.yml
with:
ref: ${{ (needs.update_packages.outputs.commit_long_sha || '') }}
upload-release:
needs: [build, update_packages]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ (needs.update_packages.outputs.commit_long_sha || '') }}
- name: Download artifact - name: Download artifact
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
merge-multiple: true merge-multiple: true
path: dist path: dist
- name: Retrieve version - name: Install packages
run: | run: |
sudo apt-get update sudo apt-get update -y
sudo apt-get install jq sudo apt-get install jq -y
bash ./.github/workflows/retrieve_version.sh
- name: Get Release Notes HTML - name: Get Release Notes HTML
run: echo "release_html=$(jq -r --arg version "$VERSION" '.["desktop-release-notes." + $version]' ./dist/release_notes.json)" >> $GITHUB_ENV id: release_notes
run: echo "release_html=$(jq -r --arg version "${{ needs.update_packages.outputs.version }}" '.["desktop-release-notes." + $version]' ./dist/release_notes.json)" >> $GITHUB_OUTPUT
- run: rm -rf dist/release_notes.json - run: rm -rf dist/release_notes.json
- name: Tag Repo - name: Tag Repo
uses: richardsimko/update-tag@v1 uses: richardsimko/update-tag@v1
with: with:
tag_name: ${{ env.tag_name }} tag_name: ${{ needs.update_packages.outputs.tag_name}}
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -106,8 +132,8 @@ jobs:
allowUpdates: true allowUpdates: true
artifacts: dist/* artifacts: dist/*
makeLatest: true makeLatest: true
name: ${{ env.release_name }} name: ${{ needs.update_packages.outputs.release_name }}
replacesArtifacts: true replacesArtifacts: true
tag: ${{ env.tag_name }} tag: ${{ needs.update_packages.outputs.tag_name }}
body: ${{ env.release_html }} body: ${{ steps.release_notes.outputs.release_html }}

View File

@ -7,7 +7,7 @@ pkgdesc="Yandex Music - Personal recommendations, selections for any occasion an
arch=("any") arch=("any")
url="https://github.com/cucumber-sp/yandex-music-linux" url="https://github.com/cucumber-sp/yandex-music-linux"
license=("custom") license=("custom")
depends=("electron27" "libpulse" "xdg-utils") depends=("electron29" "libpulse" "xdg-utils")
makedepends=("p7zip" "nodejs" "asar" "jq" "python") makedepends=("p7zip" "nodejs" "asar" "jq" "python")
source=("https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.14.exe" "git+https://github.com/cucumber-sp/yandex-music-linux") source=("https://music-desktop-application.s3.yandex.net/stable/Yandex_Music_x64_5.0.14.exe" "git+https://github.com/cucumber-sp/yandex-music-linux")
@ -29,10 +29,11 @@ package() {
install -Dm644 "$srcdir/app/favicon.svg" "$pkgdir/usr/share/icons/hicolor/scalable/apps/yandex-music.svg" install -Dm644 "$srcdir/app/favicon.svg" "$pkgdir/usr/share/icons/hicolor/scalable/apps/yandex-music.svg"
install -Dm644 "$srcdir/yandex-music-linux/templates/desktop" "$pkgdir/usr/share/applications/yandex-music.desktop" install -Dm644 "$srcdir/yandex-music-linux/templates/desktop" "$pkgdir/usr/share/applications/yandex-music.desktop"
install -Dm644 "$srcdir/yandex-music-linux/templates/default.conf" "$pkgdir/usr/lib/yandex-music/default.conf"
sed -i "s|%electron_path%|/usr/bin/electron29|g" "$pkgdir/usr/lib/yandex-music/default.conf"
install -Dm644 "$srcdir/yandex-music-linux/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" install -Dm644 "$srcdir/yandex-music-linux/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# Create a script to launch the app with Electron install -Dm755 "$srcdir/yandex-music-linux/templates/yandex-music.sh" "$pkgdir/usr/bin/yandex-music"
echo "#!/bin/sh" > "$pkgdir/usr/bin/yandex-music"
echo 'exec electron27 /usr/lib/yandex-music/yandex-music.asar "$@"' >> "$pkgdir/usr/bin/yandex-music"
chmod 755 "$pkgdir/usr/bin/yandex-music"
} }

View File

@ -36,15 +36,15 @@ build_tarball(){
install -Dm644 "${TEMPDIR}/app/favicon.svg" "${app_dir}/usr/share/icons/hicolor/scalable/apps/yandex-music.svg" install -Dm644 "${TEMPDIR}/app/favicon.svg" "${app_dir}/usr/share/icons/hicolor/scalable/apps/yandex-music.svg"
install -Dm644 "./templates/desktop" "${app_dir}/usr/share/applications/yandex-music.desktop" install -Dm644 "./templates/desktop" "${app_dir}/usr/share/applications/yandex-music.desktop"
install -Dm644 "./templates/default.conf" "${app_dir}/usr/lib/yandex-music/default.conf"
sed -i "s|%electron_path%|/usr/lib/yandex-music/electron/electron|g" "${app_dir}/usr/lib/yandex-music/default.conf"
install -Dm644 "./LICENSE.md" "${app_dir}/usr/share/licenses/yandex-music/LICENSE" install -Dm644 "./LICENSE.md" "${app_dir}/usr/share/licenses/yandex-music/LICENSE"
mv "${TEMPDIR}/electron-${arch}/" "${app_dir}/usr/lib/yandex-music/electron" mv "${TEMPDIR}/electron-${arch}/" "${app_dir}/usr/lib/yandex-music/electron"
echo "#!/bin/sh" > "${app_dir}/usr/bin/yandex-music" install -Dm755 "./templates/yandex-music.sh" "${app_dir}/usr/bin/yandex-music"
echo 'exec /usr/lib/yandex-music/electron/electron /usr/lib/yandex-music/yandex-music.asar "$@"' >> "${app_dir}/usr/bin/yandex-music"
chmod 755 "${app_dir}/usr/bin/yandex-music"
cd "${app_dir}" cd "${app_dir}"
tar cvfz "${OUTPUT_DIR}/yandex-music_${version}_${arch}.tar.gz" * tar -czf "${OUTPUT_DIR}/yandex-music_${version}_${arch}.tar.gz" *
cd "${INITIAL_DIR}" cd "${INITIAL_DIR}"
} }

View File

@ -7,7 +7,7 @@ pkgdesc="Yandex Music - Personal recommendations, selections for any occasion an
arch=("any") arch=("any")
url="https://github.com/cucumber-sp/yandex-music-linux" url="https://github.com/cucumber-sp/yandex-music-linux"
license=("custom") license=("custom")
depends=("electron27" "libpulse" "xdg-utils") depends=("electron29" "libpulse" "xdg-utils")
makedepends=("p7zip" "nodejs" "asar" "jq" "python") makedepends=("p7zip" "nodejs" "asar" "jq" "python")
source=("%exe_link%" "git+https://github.com/cucumber-sp/yandex-music-linux") source=("%exe_link%" "git+https://github.com/cucumber-sp/yandex-music-linux")
@ -29,10 +29,11 @@ package() {
install -Dm644 "$srcdir/app/favicon.svg" "$pkgdir/usr/share/icons/hicolor/scalable/apps/yandex-music.svg" install -Dm644 "$srcdir/app/favicon.svg" "$pkgdir/usr/share/icons/hicolor/scalable/apps/yandex-music.svg"
install -Dm644 "$srcdir/yandex-music-linux/templates/desktop" "$pkgdir/usr/share/applications/yandex-music.desktop" install -Dm644 "$srcdir/yandex-music-linux/templates/desktop" "$pkgdir/usr/share/applications/yandex-music.desktop"
install -Dm644 "$srcdir/yandex-music-linux/templates/default.conf" "$pkgdir/usr/lib/yandex-music/default.conf"
sed -i "s|%electron_path%|/usr/bin/electron29|g" "$pkgdir/usr/lib/yandex-music/default.conf"
install -Dm644 "$srcdir/yandex-music-linux/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" install -Dm644 "$srcdir/yandex-music-linux/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# Create a script to launch the app with Electron install -Dm755 "$srcdir/yandex-music-linux/templates/yandex-music.sh" "$pkgdir/usr/bin/yandex-music"
echo "#!/bin/sh" > "$pkgdir/usr/bin/yandex-music"
echo 'exec electron27 /usr/lib/yandex-music/yandex-music.asar "$@"' >> "$pkgdir/usr/bin/yandex-music"
chmod 755 "$pkgdir/usr/bin/yandex-music"
} }

2
templates/default.conf Normal file
View File

@ -0,0 +1,2 @@
ELECTRON_BIN=%electron_path%
ELECTRON_ARGS="--no-sandbox"

28
templates/yandex-music.sh Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
set -e
CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
CONFIG_FILE="${YANDEX_MUSIC_CONFIG:-$CONFIG_HOME/yandex-music.conf}"
echo "Using config file: ${CONFIG_FILE}"
if [ ! -f "$CONFIG_FILE" ]; then
echo "Config file not found, copying default"
mkdir -p "$(dirname "$CONFIG_FILE")"
cp /usr/lib/yandex-music/default.conf "$CONFIG_FILE"
fi
source "$CONFIG_FILE"
WAYLAND_FLAGS=""
if [ "$XDG_SESSION_TYPE" == "wayland" ]; then
WAYLAND_FLAGS="--enable-features=UseOzonePlatform --ozone-platform=wayland"
fi
if [ -z "$ELECTRON_BIN" ]; then
echo "ELECTRON_BIN is not set"
exit 1
fi
exec "${ELECTRON_BIN}" /usr/lib/yandex-music/yandex-music.asar "${ELECTRON_ARGS}" "${WAYLAND_FLAGS}"

View File

@ -46,7 +46,7 @@ print(f"Sha256: {exe_sha256}")
print("Getting latest electron version") print("Getting latest electron version")
electron_releases = requests.get(ELECTRON_VERSIONS_URL).json() electron_releases = requests.get(ELECTRON_VERSIONS_URL).json()
electron_versions = list(map(lambda x: x["version"], electron_releases)) electron_versions = list(map(lambda x: x["version"], electron_releases))
electron_versions = list(filter(lambda x: "-" not in x and x.startswith("27"), electron_versions)) electron_versions = list(filter(lambda x: "-" not in x and x.startswith("29"), electron_versions))
electron_version = electron_versions[0] electron_version = electron_versions[0]
print(f"Latest electron version: {electron_version}") print(f"Latest electron version: {electron_version}")
electron_x64 = ELECTRON_DOWNLOAD_URL.format(electron_version, "x64") electron_x64 = ELECTRON_DOWNLOAD_URL.format(electron_version, "x64")

View File

@ -6,9 +6,9 @@
"exe_sha256": "c10c6c4b5d596f9bf490a231d7c13bbd2627109f71c9c57aa4e2b034e31252f4" "exe_sha256": "c10c6c4b5d596f9bf490a231d7c13bbd2627109f71c9c57aa4e2b034e31252f4"
}, },
"electron": { "electron": {
"version": "27.3.5", "version": "29.1.1",
"x64": "https://github.com/electron/electron/releases/download/v27.3.5/electron-v27.3.5-linux-x64.zip", "x64": "https://github.com/electron/electron/releases/download/v29.1.1/electron-v29.1.1-linux-x64.zip",
"armv7l": "https://github.com/electron/electron/releases/download/v27.3.5/electron-v27.3.5-linux-armv7l.zip", "armv7l": "https://github.com/electron/electron/releases/download/v29.1.1/electron-v29.1.1-linux-armv7l.zip",
"arm64": "https://github.com/electron/electron/releases/download/v27.3.5/electron-v27.3.5-linux-arm64.zip" "arm64": "https://github.com/electron/electron/releases/download/v29.1.1/electron-v29.1.1-linux-arm64.zip"
} }
} }