-
-
Notifications
You must be signed in to change notification settings - Fork 10
159 lines (155 loc) · 5.15 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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"