Merge pull request #300 from bohning/custom-data #45
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" # Only create releases on matching tags following semver X.Y.Z | |
jobs: | |
scrape-song-list: | |
name: Scrape USDB song list | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install Linux specific dependencies for dbus-python | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc python3-dev libdbus-1-dev | |
pkg-config --cflags --libs dbus-1 | |
export LDFLAGS="-lm" | |
- name: Install poetry | |
run: | | |
python -m pip install poetry | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Scrape USDB song list to ship with the bundle | |
run: > | |
poetry run generate_song_list_json | |
-t 'song_list.json' | |
-u '${{ secrets.USDB_USER }}' | |
-p '${{ secrets.USDB_PASSWORD }}' | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: | | |
song_list.json | |
CHANGELOG.md | |
build: | |
name: Build packages | |
runs-on: ${{ matrix.os }} | |
needs: scrape-song-list | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
TARGET: Linux | |
PYINSTALLER_ARGS: >- | |
--onefile | |
--add-data 'artifacts/song_list.json:data' | |
--add-data 'src/usdb_syncer/db/sql:src/usdb_syncer/db/sql' | |
- os: macos-latest | |
TARGET: macOS | |
PYINSTALLER_ARGS: >- | |
--windowed | |
--icon src/usdb_syncer/gui/resources/appicon_128x128.png | |
--add-data 'artifacts/song_list.json:data' | |
--add-data 'src/usdb_syncer/db/sql:src/usdb_syncer/db/sql' | |
- os: windows-latest | |
TARGET: Windows | |
PYINSTALLER_ARGS: >- | |
--onefile | |
--icon src/usdb_syncer/gui/resources/appicon_128x128.png | |
--add-data 'artifacts/song_list.json;data' | |
--add-data 'src/usdb_syncer/db/sql;src/usdb_syncer/db/sql' | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
- name: Install Linux specific dependencies for dbus-python | |
if: matrix.TARGET == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y gcc python3-dev libdbus-1-dev | |
pkg-config --cflags --libs dbus-1 | |
export LDFLAGS="-lm" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v4 | |
with: | |
version: "6.7.*" | |
setup-python: false | |
no-qt-binaries: true | |
- name: Install poetry | |
run: | | |
python -m pip install poetry | |
- name: Install dependencies | |
run: | | |
poetry install --without dev | |
- name: Write version and commit hash | |
run: > | |
poetry run write_release_info | |
-p src/usdb_syncer/constants.py | |
-v ${{ github.ref_name }} | |
-c ${{ github.workflow_sha }} | |
- name: Generate GUI elements | |
run: poetry run generate_pyside_files | |
- name: Build with pyinstaller for ${{matrix.os}} | |
# _tkinter hook is run erroneously? | |
run: > | |
poetry run pyinstaller | |
-n 'USDB_Syncer-${{github.ref_name}}-${{matrix.TARGET}}' | |
--exclude-module _tkinter | |
${{matrix.PYINSTALLER_ARGS}} | |
src/usdb_syncer/gui/__init__.py | |
- name: Create DMG | |
if: matrix.TARGET == 'macOS' | |
run: | | |
brew install create-dmg | |
create-dmg \ | |
--volname "USDB Syncer" \ | |
--volicon "src/usdb_syncer/gui/resources/appicon_128x128.png" \ | |
--window-pos 200 120 \ | |
--window-size 600 300 \ | |
--icon-size 128 \ | |
--text-size 14 \ | |
--icon "USDB_Syncer-${{github.ref_name}}-${{matrix.TARGET}}.app" 175 120 \ | |
--hide-extension "USDB_Syncer-${{github.ref_name}}-${{matrix.TARGET}}.app" \ | |
--app-drop-link 425 120 \ | |
--hdiutil-quiet \ | |
--no-internet-enable \ | |
"dist/USDB_Syncer-${{github.ref_name}}-${{matrix.TARGET}}.dmg" \ | |
"dist/USDB_Syncer-${{github.ref_name}}-${{matrix.TARGET}}.app" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.os }}-artifacts | |
path: | | |
dist/*Linux | |
dist/*.dmg | |
dist/*.exe | |
release: | |
name: Create release | |
permissions: | |
contents: write | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
merge-multiple: true | |
- name: Extract Release Notes | |
id: extract_notes | |
run: > | |
awk 'BEGIN { RS="<!-- [0-9]+\\.[0-9]+\\.[0-9]+ -->\\s*"; ORS=""; } | |
NR==2 { print $0; exit; }' | |
artifacts/CHANGELOG.md >CHANGELOG.md | |
shell: bash | |
- uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "artifacts/USDB_Syncer*" | |
bodyFile: "CHANGELOG.md" |