1- # Workflow: Build and Publish
2- # Author: Arrowar
3-
41name : Build and Publish
2+
53on :
64 workflow_dispatch :
75 inputs :
@@ -21,24 +19,30 @@ jobs:
2119 publish :
2220 if : startsWith(github.ref_name, 'v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_pypi == 'true')
2321 runs-on : ubuntu-latest
22+
2423 steps :
2524 - name : Checkout repository
2625 uses : actions/checkout@v4
2726 with :
2827 fetch-depth : 0
28+
2929 - name : Get the latest tag
3030 id : get_latest_tag
3131 run : echo "latest_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
32+
3233 - name : Set up Python
3334 uses : actions/setup-python@v4
3435 with :
35- python-version : ' 3.12'
36+ python-version : ' 3.13'
37+
3638 - name : Install packaging dependencies
3739 run : |
3840 python -m pip install --upgrade pip
3941 python -m pip install --upgrade setuptools>=61.0.0 wheel twine build
42+
4043 - name : Build package
4144 run : python -m build
45+
4246 - name : Upload to PyPI
4347 env :
4448 TWINE_USERNAME : __token__
@@ -47,33 +51,35 @@ jobs:
4751
4852 build :
4953 if : startsWith(github.ref_name, 'v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_pypi == 'false')
54+
5055 strategy :
5156 matrix :
5257 include :
5358 - os : windows-latest
5459 artifact_name : StreamingCommunity_win
5560 executable : StreamingCommunity_win.exe
5661 separator : ' ;'
57- is_windows : true
62+
5863 - os : macos-latest
5964 artifact_name : StreamingCommunity_mac
6065 executable : StreamingCommunity_mac
6166 separator : ' :'
62- is_windows : false
67+
6368 - os : ubuntu-latest
6469 artifact_name : StreamingCommunity_linux_latest
6570 executable : StreamingCommunity_linux_latest
6671 separator : ' :'
67- is_windows : false
72+
6873 - os : ubuntu-22.04
6974 artifact_name : StreamingCommunity_linux_previous
7075 executable : StreamingCommunity_linux_previous
7176 separator : ' :'
72- is_windows : false
77+
7378 runs-on : ${{ matrix.os }}
7479 defaults :
7580 run :
7681 shell : bash
82+
7783 steps :
7884 - name : Checkout repository
7985 uses : actions/checkout@v4
@@ -99,24 +105,10 @@ jobs:
99105 python -m pip install -r requirements.txt
100106 python -m pip install pyinstaller
101107
102- - name : Create version file for Windows (inline)
103- if : matrix.is_windows
104- shell : bash
105- run : |
106- cat <<EOF > version.txt
107- # UTF-8
108- [Version]
109- CompanyName=Arrowar
110- FileDescription=StreamingCommunity by Arrowar
111- LegalCopyright=© Arrowar
112- ProductName=StreamingCommunity
113- ProductVersion=3.3.1
114- EOF
115-
116108 - name : Build executable with PyInstaller
117109 shell : bash
118110 run : |
119- CMD=" pyinstaller --onefile --hidden-import=pycryptodomex --hidden-import=ua_generator \
111+ pyinstaller --onefile --hidden-import=pycryptodomex --hidden-import=ua_generator \
120112 --hidden-import=qbittorrentapi --hidden-import=qbittorrent \
121113 --hidden-import=bs4 --hidden-import=httpx --hidden-import=rich --hidden-import=tqdm \
122114 --hidden-import=m3u8 --hidden-import=psutil --hidden-import=unidecode \
@@ -138,18 +130,8 @@ jobs:
138130 --hidden-import=curl_cffi --hidden-import=_cffi_backend \
139131 --collect-all curl_cffi \
140132 --additional-hooks-dir=pyinstaller/hooks \
141- --add-data \"StreamingCommunity${{ matrix.separator }}StreamingCommunity\" \
142- --name=${{ matrix.artifact_name }}"
143-
144- # Aggiungi il file version.txt solo su Windows
145- if [[ "${{ matrix.is_windows }}" == "true" ]]; then
146- CMD+=" --version-file=version.txt"
147- fi
148-
149- CMD+=" test_run.py"
150-
151- echo "Running: $CMD"
152- eval $CMD
133+ --add-data "StreamingCommunity${{ matrix.separator }}StreamingCommunity" \
134+ --name=${{ matrix.artifact_name }} test_run.py
153135
154136 - name : Upload executable
155137 uses : actions/upload-artifact@v4
@@ -164,4 +146,4 @@ jobs:
164146 tag_name : ${{ github.ref_name }}
165147 files : dist/${{ matrix.executable }}
166148 env :
167- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
149+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments