0
0
mirror of https://github.com/cucumber-sp/yandex-music-linux.git synced 2024-12-23 22:22:59 +03:00

Release notes

This commit is contained in:
Andrey Onishchenko 2024-02-09 17:35:17 +03:00
parent a28db76a6b
commit 1f0975300f
8 changed files with 72 additions and 6 deletions

View File

@ -16,7 +16,7 @@ case $OS in
"Arch Linux")
echo "Arch Linux"
pacman -Syy --noconfirm
pacman -S --noconfirm git sudo base-devel p7zip nodejs jq asar electron libpulse dpkg unzip xdg-utils
pacman -S --noconfirm git sudo base-devel p7zip nodejs jq asar electron libpulse dpkg unzip xdg-utils python
# fix makepkg from non-root
mkdir /home/build
chgrp nobody /home/build
@ -30,6 +30,7 @@ case $OS in
mv *.pkg.tar.zst dist
mv ./src/app/yandexmusic.asar dist/yandexmusic.asar
mv ./src/app/release_notes.json dist/release_notes.json
sh ./build_deb.sh -a all
mv deb/*.deb dist

View File

@ -44,6 +44,11 @@ jobs:
path: ./dist/*.asar
name: asar-packages
- name: Upload Release Notes
uses: actions/upload-artifact@v4
with:
path: ./dist/release_notes.json
nix-build:
runs-on: ubuntu-latest
env:

View File

@ -55,11 +55,11 @@ jobs:
commit_long_sha: ${{ steps.commit.outputs.commit_long_sha }}
build:
if: ${{ (github.event_name == 'push') || (github.event_name == 'workflow_dispatch') || (needs.update_packages.new_version) }}
if: ${{ (github.event_name == 'push') || (github.event_name == 'workflow_dispatch') || (needs.update_packages.outputs.new_version) }}
needs: update_packages
uses: ./.github/workflows/build.yml
with:
ref: ${{ (needs.update_packages.commit_long_sha || '') }}
ref: ${{ (needs.update_packages.outputs.commit_long_sha || '') }}
upload-release:
needs: build
@ -68,7 +68,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ (needs.build.needs.update_packages.commit_long_sha || '') }}
ref: ${{ (needs.build.needs.update_packages.outputs.commit_long_sha || '') }}
- name: Download artifact
uses: actions/download-artifact@v4
@ -82,6 +82,11 @@ jobs:
sudo apt-get install jq
sh ./.github/workflows/retrieve_version.sh
- name: Get Release HTML
run: echo "release_html=$(jq -r '."desktop-release-notes.$VERSION"' ./dist/release_notes.json)" >> $GITHUB_ENV
- run: rm -rf dist/release_notes.json
- name: Tag Repo
uses: richardsimko/update-tag@v1
with:
@ -98,4 +103,5 @@ jobs:
name: ${{ env.release_name }}
replacesArtifacts: true
tag: ${{ env.tag_name }}
body: ${{ env.release_html }}

View File

@ -6,6 +6,7 @@
, p7zip
, asar
, jq
, python3
, electron
, ymExe ? null
@ -23,6 +24,7 @@ stdenvNoCC.mkDerivation
p7zip
asar
jq
python3
makeWrapper
];

View File

@ -14,6 +14,7 @@ usage() {
exe_location=
dst="$PWD/app"
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
fix_quit=1
while getopts :xo:qh name; do
case $name in
@ -115,5 +116,6 @@ asar pack "$TEMPDIR/app" "$dst/yandexmusic.asar"
for ext in png svg; do
mv "$TEMPDIR/app/build/next-desktop/favicon.$ext" "$dst"
done
python "$SCRIPT_DIR/utility/extract_release_notes.py" "$TEMPDIR/app/build/next-desktop/album.txt" "$dst/release_notes.json"
echo "Done"

View File

@ -8,7 +8,7 @@ arch=("any")
url="https://github.com/cucumber-sp/yandex-music-linux"
license=("custom")
depends=("electron" "libpulse" "xdg-utils")
makedepends=("p7zip" "nodejs" "asar" "jq")
makedepends=("p7zip" "nodejs" "asar" "jq" "python")
source=("%exe_link%" "git+https://github.com/cucumber-sp/yandex-music-linux")
sha256sums=("%exe_sha256%" "SKIP")

View File

@ -0,0 +1,50 @@
import sys
import json
if len(sys.argv) < 3:
print("Usage: python extract_release_notes.py <file_name>")
sys.exit(1)
file_name = sys.argv[1]
save_file_name = sys.argv[2]
def build_html(data, first_launch=False):
html = ""
for i, element in enumerate(data):
if element['type'] == 0:
if first_launch and i == 0:
html += f"<h2>{element['value']}</h2>".replace('\n', '<br/>')
continue
if element['value'] == '\n':
html += "<br/>"
else:
html += f"<span>{element['value']}</span>".replace('\n', '<br/>')
elif element['type'] == 8:
html += f"<{element['value']}>{build_html(element['children'])}</{element['value']}>"
return html
with open(file_name, "r", encoding='utf-8') as file:
full_text = file.read()
notes = {}
position = full_text.find("desktop-release-notes.")
while position != -1:
start_position = position
while full_text[position] != '"':
position += 1
name = full_text[start_position:position]
position += 2
start_position = position
braces_count = 1
while braces_count > 0:
position += 1
if full_text[position] == '{' or full_text[position] == '[':
braces_count += 1
elif full_text[position] == '}' or full_text[position] == ']':
braces_count -= 1
data = full_text[start_position:position + 1]
notes[name] = build_html(json.loads(data), True)
position = full_text.find("desktop-release-notes.", position)
with open(save_file_name, "w", encoding='utf-8') as file:
file.write(json.dumps(notes, ensure_ascii=False, indent=4))