Files
swingmusic-extended/.github/workflows/release.yml
T
michily e770606567 merge refactors pr #364 from @michilyy
* Save to DB only unique trackhashes

* Add check if track already exists in playlist

* replace all paths with `pathlib.Path`

* `architecture.md`:
* add config folder layout

`config.py`:
* fix bug where `pathlib.Path` cannot be serialized

`files.py`:
* remove unused imports
* update path concatenation to `pathlib.Path`
* add config-folder creation

`imgserver.py`:
* fix serialisation bug

`playlistlib.py`:
* update path concatenation to `pathlib.Path`

* update all `settings.Paths` usages to new singleton `Paths` class.

* update all usages of `settings.Paths`

* `files.py`:
* rework assets copy function.
* remove unused loop and unused `shutil.copy2` function

`settings.py`
* fix recursion exception in `Paths`

* `settings.py`:
* remove Singleton and `@property` todos from `Paths`

* `__init__.py`:
* remove now unused function `create_config_dir()`

`setup.files`:
* remove because merged into `settings.Paths()`
  for more central and clear flow how the base path gets decided

`settings.py`:
* add `copy_assets` function

`start_swingmusic.py`:
* add configurable settings.Paths class

`__main__.py`:
* update click to used correct default path

* remove wrong commited egg files

* remove change in the wrong branch

* add forgotten `property` decorator
update `get_files_and_dirs` to use pathlib where possible

`config.py`:
* update type annotation

`folders.py`:
* convert `pathlib` to posix path where needed for sub-functions

`folderlib.py`:
* rework `get_files_and_dirs` to use `pathlib` where possible

`settings.py`:
* add forgotten `@property`

`start_swingmusic.py`:
* remove second `log_startup_info()`

* `artistlib.py`:
* fix calling property
`tagger.py`:
* fix comparing elements in `pathlib.Path`

* add support for repeating lyrics.

* rework lyrics api and lib

* update most path functions.
add type-hint pathlib where needed

* for serialization paths are converted to posix path

* use `open` instead of `os.open`
update `metaclass` with constant

* fix initial config exception if empty file existed

* update `userConfig` with `InitVar` to be excluded from `asdict`

* remove `is_windows_slash()`
rework path function to use pathlib

* convert `pathlib.Path` to `str` for serialization

* fixing bug with str + pathlib

* `__main__.py`:
* update click to use package version
* remove now unused function `print_version`

`filesystem.py`:
* rework `CWD` to use importlib

`pyproject.toml`:
* disable namespace for `importlib.resources` to work correctly

* update `lyrics.py`:
* remove unused functions
* simplify functions

* fix bug where assets get created on root

* remove unused code

* update lyrics for clearer structure.

* add support for unsynced lyrics

* fix wrong return type in unsynced lyrics

* update `/check` to use `send_lyrics`

* prefer tags to duplicates

* `lyrics.py`:
* add docs to a function group

* `logger.py`:
* add logging config dict.
* combine Logging into one file
* add socket logger
* add debug mode to logger
* add JSONL formater

* `logger.py`:
* update config to directly use the formater.
resolves circular import exception

`__main__.py`:
* add logger setup to main

`start_swingmusic.py`:
* add debug option to cli

* `lyrics.py`:
* add offset support

* add `setuptools-scm` to get version from git

* add support for docker build with scm

* add support for docker build with scm
need someone who can test the changes workflow

* update all usage of `version.txt` to `metadata.version()`

* 2x update all usage of `version.txt` to `metadata.version()`

* update to no local_scheme version

* provide fix for #331.
convert `sql.Row` and `TrackTable` to dict before converting to dataclass.

* fix `__main__.py`:
* wrong import and uncommited changes
* add debug and base_path parameter

* fix logger pathlib

* add client build workflow

* set name

* split client from build

* try fixing builds

* try another fix

* try also another fix

* try again something new

* try again something new

* change runner

* fix failed run because of malformed runner

* add wheel builds

* remove systems from pure python build

* add isolated pyinstaller build

* artifacts with names

* wrong wheel path

* try fetch-depth for tag fetch

* disable fail-fast.
add wheel installation

* add install system packages

* add debug

* fix wheel install
fix pyinstaller spec file

* try fix for pyinstaller

* try another fix

* build on release

* add concrete release types

* only run on released or pre-released

* try release upload

* reformat upload

* fix needs tag

* identifiable pyinstaller builds

* compress client folder before uploading

* update to src build

* remove no more needed aarch64 build script
rename pyinstaller assets to lowercase

* remove unneeded code

* fix: save to DB only unique track hashes

* replace click with argparse

* set concrete types in argparse

* replace manuall path usages with pathlib

* remove unused `configs.py` file

* reformat `start_swingmusic.py`

* fix empty set startup exception

* optimizing static files serve function

* fixing bug in optimisation of static files serve function

* fix folder view bug

* colorlib.py:
* fix wrong type exception
* remove singe use Index_everything class
* update logging of populate.py

* cleanup files

* fix settings.py Paths copy function.
Created folder on file.

* add exist check to folder

* remove unused `INFO` class

* fix multiprocessing bug on windows

* potential icon fix for pyinstaller
fix multiple logging bug

* fix argparse config path bug
add jobs file

* cleanup code fragments
fix logging issue
add notes to function

* note that concurrent creates own sys.modules

* refactor some lyrics plugin condition
remove unused import from hashing

* refactor taglib.py

* update import statements to be static

* playlistlib.py:
* refactoring and more doc strings
populate.py:
* add poc bugfix
settings.py:
* add typehint

* possible bugfix for multitreading globals

* folder.py:
* add check if provided path is absolute
populate.py:
* add bug note
settings.py:
* add possible error from Singleton implementation
start_swingmusic.py:
* correct spelling
* pass resolved path to Paths
tagger.py:
* add logging

* trying out fixes for multithreading

* only upload results not metadata

* fix build action again

* folder.py:
* strictly use pathlib where possible

folderlib.py:
* add missing docstring to function, who really need it.

track.py:
* refactor some code

folder.py:
* refactor some more code

* Merge DBPath class and Paths class.
Update all usages of DBPath

folderslib.py:
* fix bug with logging

taglib.py:
* add missing docstring

settings.py:
* merge classes
* refactor

* network.py:
* add more docstring

config.py:
* update pathlib usage

tools.py:
* refactor
* add docstrings

* colorlib.py:
* add docstring

Refactor App builder into grouped config settings.

* update assets access for migration

* Update FUNDING.yml

* Update FUNDING.yml

* upgrade tinytag in requirements.txt

* update readme

* update license

* update readme

* Update README.md

* Update README.md

* cleanup requirements.txt
remove unused import in audio_segment.py
add entrypoint.sh for appimage support
update pyproject.toml for optional dependencies
add appimage to github workflow

* fix invalid workflow file

* AppImage build needs more research.
Commenting for now

* testing a new build workflow

* add libev installation

* update workflow to new optional dependencies

* trying again another fix

* finally fix all optional deps installation correctly

* remove AppImage poc

* albumslib.py:
* add docstring

folder.py:
* add unix path fix

update logger name to `__name__`

* update build with docker
update Dockerfile with git
fix typo in lyrics.py
add dynamic deps back

* add log for static folder

* add missing import

* add some more todos

* add support for AppImages even when it's not perfect.

* quick bugfix for wrong appimage config path

* fix uploading not finding AppImages builds aka wrong pattern

* optimise docker build by using artifacts.
Add client path option.
change docstring to sphinx format

* add todos

* Now support AppImages for real:
manually build AppImage as we are building a complex project.

* fix missing dep in AppImage build

* add full AppImage metadata

* add missing image file.

* only update swingmusic appimage not tool

* add todo and fix AppImage build again.

* Try fixing some path mixup in AppImage build

* add debug tag to action

* correct path to appimage folder

* do not download tool before checkout

* Another fix for path in appimage build

* extend config files with more information

* default client dir is now inside the config dir.
TODOs updated.

* default client dir is now inside the config dir.
TODOs updated.
Add priority todos.

* Auto download client when client not found.
Respects user provided dir.

* rename `requests` submodule to `request`

* poc for arm AppImage builds

* try out another fix

* fix typo in build.yml

* add missing arch tag

* fix uploading double names

* unique naming

* enable fallback version for project.

* do not download client into readonly dir.

* fix relative client download path. Client was resolved into parent of config.

* remove client backup path as client is now downloadable

* `Paths` checks if config folder exists and creates it if necessary.
logger no more creates the config folder.
`app_builder.py`: static route no more with '/client'

* path are only created in MainProcess.
fix gz file not found.

* move assets into src and update usages accordingly

* remove solved todos

* Only upload artefacts if not draft/master aka only on tag

* wrong type in assets copy

* update log with correct priority

* add debug statements and logging to Paths

* remove debugging statement

* remove double version tag from docker build

* fork save release protection

* fix typo

* add fallback client dir for static builds.

* update argparse to new param

* add missing import pathlib

* add sparse checkout as we do not need everything downloaded

* add assets copy check

* init logger bevor Paths

* remove unused import

* check if logdir exists and create if not

* only add exec info to file

* remove exception log from cli

* move logging into main.
Allows tools support again.

* UserConfig now correctly uses _finished key.
Bug where _finished was never written

* double save serverId.
update root_dir to trow no exception on init.
remove debug param

* clean up TODOs

---------

Co-authored-by: skilletfun <skilletfun.laptew.sergey@yandex.ru>
Co-authored-by: Mungai Njoroge <geoffreymungai45@gmail.com>
2025-08-28 12:28:11 +03:00

282 lines
9.1 KiB
YAML

name: New Release
run-name: Release v${{ github.event.inputs.tag }}
on:
workflow_dispatch:
inputs:
tag:
description: "Tag"
required: true
default: "1.x.x"
binary_build:
description: "Build platform binaries"
required: true
default: "true"
type: choice
options:
- true
- false
is_latest:
description: "Set as latest"
required: true
default: "false"
type: choice
options:
- true
- false
is_draft:
description: "Set as draft"
required: true
type: choice
default: "true"
options:
- true
- false
build_docker:
description: "Build Docker image"
required: true
type: choice
default: "true"
options:
- true
- false
jobs:
build:
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-13, macos-14]
if: ${{ github.event.inputs.binary_build == 'true' }}
runs-on: ${{ matrix.os }}
name: Create binary on ${{ matrix.os }}
steps:
- name: Clone client
uses: actions/checkout@v3
with:
fetch-tags: true
- name: Install Python 3.11
uses: actions/setup-python@v2
with:
python-version: "3.11.x"
- name: Create virtualenv
run: |
python -m venv .venv
- name: Setup Homebrew
if: ${{ startsWith(matrix.os, 'macos') }}
uses: Homebrew/actions/setup-homebrew@master
- name: Install libev (macOS)
if: ${{ startsWith(matrix.os, 'macos') }}
run: |
brew install libev
- name: Install libev (Linux)
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt-get install libev-dev -y > /dev/null
- name: Activate virtualenv (unix)
if: ${{ !startsWith(matrix.os, 'win') }}
run: |
source .venv/bin/activate
- name: Activate virtualenv (windows)
if: ${{ startsWith(matrix.os, 'win') }}
run: |
.venv\Scripts\Activate
- name: Install swingmusic
run: |
pip install .
- name: Build server
run: |
python run.py --build
- name: Rename Unix binary
if: ${{ !startsWith(matrix.os, 'win') }}
run: |
if [[ "${{ matrix.os }}" == *"macos"* ]]; then
if [[ "${{ matrix.os }}" == *"14"* ]]; then
mv dist/swingmusic dist/swingmusic_macos_arm64
else
mv dist/swingmusic dist/swingmusic_macos_amd64
fi
elif [[ "${{ matrix.os }}" == *"arm64"* ]]; then
mv dist/swingmusic dist/swingmusic_linux_arm64
else
mv dist/swingmusic dist/swingmusic_linux_amd64
fi
- name: Verify Unix build success
if: ${{ !startsWith(matrix.os, 'win') }}
run: |
if [[ "${{ matrix.os }}" == *"macos"* ]]; then
if [[ "${{ matrix.os }}" == *"14"* ]]; then
if [ ! -f "./dist/swingmusic_macos_arm64" ]; then
echo "Build failed"
exit 1
fi
else
if [ ! -f "./dist/swingmusic_macos_amd64" ]; then
echo "Build failed"
exit 1
fi
fi
elif [[ "${{ matrix.os }}" == *"arm64"* ]]; then
if [ ! -f "./dist/swingmusic_linux_arm64" ]; then
echo "Build failed"
exit 1
fi
else
if [ ! -f "./dist/swingmusic_linux_amd64" ]; then
echo "Build failed"
exit 1
fi
fi
- name: Verify Windows build success
if: ${{ startsWith(matrix.os, 'win') }}
run: |
if ($env:matrix_os -like "*arm*") {
if (-not (Test-Path "./dist/swingmusic_arm64.exe")) {
Write-Host "Build failed"
exit 1
}
} else {
if (-not (Test-Path "./dist/swingmusic.exe")) {
Write-Host "Build failed"
exit 1
}
}
- name: Upload Unix binary
if: ${{ !startsWith(matrix.os, 'win') }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os == 'ubuntu-22.04-arm64' && 'linux-arm64' || matrix.os == 'macos-14' && 'macos-arm64' || matrix.os == 'macos-13' && 'macos-amd64' || 'linux-amd64' }}
path: ${{ matrix.os == 'ubuntu-22.04-arm64' && 'dist/swingmusic_linux_arm64' || matrix.os == 'macos-14' && 'dist/swingmusic_macos_arm64' || matrix.os == 'macos-13' && 'dist/swingmusic_macos_amd64' || 'dist/swingmusic_linux_amd64' }}
retention-days: 1
- name: Upload Windows binary
if: ${{ startsWith(matrix.os, 'win') }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os == 'windows-11-arm' && 'win-arm64' || 'win-amd64' }}
path: ${{ matrix.os == 'windows-11-arm' && 'dist/swingmusic_arm64.exe' || 'dist/swingmusic.exe' }}
retention-days: 1
# build_aarch64:
# runs-on: [ubuntu-22.04]
# name: Building aarch64 binary
# steps:
# - name: Checking out buildscript
# uses: actions/checkout@v4
# with:
# sparse-checkout: |
# aarch64_buildscript
# sparse-checkout-cone-mode: false
# - name: Installing Packages
# run: |
# sudo apt -qq update -y > /dev/null
# sudo apt -y -qq install binfmt-support qemu-user-static systemd-container wget > /dev/null
# - name: Starting Services
# run: |
# sudo systemctl restart systemd-binfmt
# sudo systemctl start systemd-resolved
# - name: Downloading Arch Linux Arm Tarball for rpi4 aarch64
# run: |
# wget -q http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-aarch64-latest.tar.gz
# - name: Extracting Tarball
# run: |
# mkdir root
# sudo tar xpf ArchLinuxARM-rpi-aarch64-latest.tar.gz -C root --warning=no-unknown-keyword
# - name: Building Swingmusic in qemu
# run: |
# chmod +x aarch64_buildscript
# sed -i -e 's/TAG/${{ github.event.inputs.tag }}/g' aarch64_buildscript
# mv aarch64_buildscript root/
# sudo systemd-nspawn --bind-ro=/etc/resolv.conf -D root ./aarch64_buildscript
# - name: Upload aarch64 binary
# uses: actions/upload-artifact@v4
# with:
# name: arm64
# path: root/swingmusicbuilder/swingmusic/dist/swingmusic_linux_arm64
# retention-days: 1
release:
name: Create New Release
runs-on: ubuntu-latest
# if: false
needs: [build]
permissions: write-all
steps:
- name: Checkout into repo
uses: actions/checkout@v3
- name: Download all binaries
uses: actions/download-artifact@v4
- name: Upload binaries to GitHub Release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "./linux-amd64/swingmusic_linux_amd64, ./win-amd64/swingmusic.exe, ./macos-amd64/swingmusic_macos_amd64, ./macos-arm64/swingmusic_macos_arm64"
# artifacts: "./linux/swingmusic_linux_amd64, ./win32/swingmusic.exe, ./arm64/swingmusic_linux_arm64"
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ format('v{0}',inputs.tag) }}
commit: ${{ github.sha }}
draft: ${{ inputs.is_draft }}
artifactErrorsFailBuild: true
name: ${{ format('v{0}',inputs.tag) }}
bodyFile: .github/changelog.md
makeLatest: ${{ inputs.is_latest }}
docker:
name: Build and push Docker image
runs-on: ubuntu-latest
permissions: write-all
if: inputs.build_docker == 'true'
# if: false
steps:
- name: Checkout into repo
uses: actions/checkout@v3
# - name: Download linux binary
# uses: actions/download-artifact@v3
# with:
# name: linux
# path: dist
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta # you'll use this in the next step
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/${{ github.repository }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64, linux/arm64 #,linux/arm
push: true
tags: ghcr.io/${{github.repository}}:${{format('v{0}', inputs.tag)}}, ${{env.LATEST_TAG}}
labels: org.opencontainers.image.title=Docker
build-args: |
app_version=${{inputs.tag}}
env:
LATEST_TAG: ${{ inputs.is_latest == 'true' && format('ghcr.io/{0}:latest', github.repository) || '' }}