Update build.yml

This commit is contained in:
None 2025-02-07 15:27:59 +01:00 committed by GitHub
parent 5a8ece17d6
commit 3b01dcaf65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,18 +13,18 @@ on:
- 'false' - 'false'
push: push:
tags: tags:
- "*" # Il workflow si eseguirà quando viene fatto un push con qualsiasi tag - "*"
jobs: jobs:
publish: publish:
if: github.event.inputs.publish_pypi == 'true' # Solo se publish_pypi è true if: github.event.inputs.publish_pypi == 'true'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 # Recupera tutti i tag e la cronologia dei commit fetch-depth: 0
- name: Get the latest tag - name: Get the latest tag
id: get_latest_tag id: get_latest_tag
@ -37,40 +37,36 @@ jobs:
- name: Install packaging dependencies - name: Install packaging dependencies
run: | run: |
echo "Installing packaging dependencies"
python -m pip install --upgrade pip python -m pip install --upgrade pip
python -m pip install setuptools wheel twine python -m pip install setuptools wheel twine
- name: Build package - name: Build package
run: | run: python setup.py sdist bdist_wheel
echo "Building the package"
python setup.py sdist bdist_wheel
- name: Upload to PyPI - name: Upload to PyPI
env: env:
TWINE_USERNAME: __token__ # Usa '__token__' per l'autenticazione con PyPI TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: | run: twine upload dist/*
echo "Uploading package to PyPI"
twine upload dist/*
build: build:
if: github.event.inputs.publish_pypi == 'false' # Solo se publish_pypi è false if: github.event.inputs.publish_pypi == 'false'
strategy: strategy:
matrix: matrix:
os: [windows-latest, ubuntu-latest] # Compila per Windows e Linux os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
fetch-depth: 0 # Recupera tutti i tag e la cronologia dei commit fetch-depth: 0
- name: Get the latest tag - name: Get the latest tag
id: get_latest_tag id: get_latest_tag
run: echo "latest_tag=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV shell: pwsh
run: |
$latestTag = git describe --tags --abbrev=0
echo "latest_tag=$latestTag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
@ -78,33 +74,39 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
echo "Installing dependencies"
python -m pip install --upgrade pip python -m pip install --upgrade pip
python -m pip install -r requirements.txt python -m pip install -r requirements.txt
python -m pip install pyinstaller python -m pip install pyinstaller
python -m pip install fake-useragent==1.1.3 # Aggiunta dipendenza fake-useragent python -m pip install fake-useragent==1.1.3
- name: Build executable with PyInstaller (Windows) - name: Build executable with PyInstaller (Windows)
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
shell: cmd shell: pwsh
run: | run: |
echo "Building Windows executable with PyInstaller" pyinstaller --onefile --hidden-import=pycryptodomex --hidden-import=fake_useragent `
pyinstaller --onefile --hidden-import=pycryptodomex --hidden-import=fake_useragent --hidden-import=qbittorrentapi --hidden-import=qbittorrent --hidden-import=googlesearch --hidden-import=bs4 --hidden-import=httpx --hidden-import=rich --hidden-import=tqdm --hidden-import=m3u8 --hidden-import=psutil --hidden-import=unidecode --hidden-import=jsbeautifier --hidden-import=pathvalidate --hidden-import=Cryptodome.Cipher --hidden-import=Cryptodome.Cipher.AES --hidden-import=Cryptodome.Util --hidden-import=Cryptodome.Util.Padding --hidden-import=Cryptodome.Random --hidden-import=Pillow --hidden-import=pyTelegramBotAPI --additional-hooks-dir=pyinstaller/hooks --add-data "StreamingCommunity;StreamingCommunity" --name=StreamingCommunity --icon=".github/media/logo.ico" test_run.py --hidden-import=qbittorrentapi --hidden-import=qbittorrent --hidden-import=googlesearch `
--hidden-import=bs4 --hidden-import=httpx --hidden-import=rich --hidden-import=tqdm `
--hidden-import=m3u8 --hidden-import=psutil --hidden-import=unidecode `
--hidden-import=jsbeautifier --hidden-import=pathvalidate `
--hidden-import=Cryptodome.Cipher --hidden-import=Cryptodome.Cipher.AES `
--hidden-import=Cryptodome.Util --hidden-import=Cryptodome.Util.Padding `
--hidden-import=Cryptodome.Random --hidden-import=Pillow `
--hidden-import=pyTelegramBotAPI --additional-hooks-dir=pyinstaller/hooks `
--add-data "StreamingCommunity;StreamingCommunity" `
--name=StreamingCommunity --icon=".github/media/logo.ico" test_run.py
- name: Build executable with PyInstaller (Linux) - name: Build executable with PyInstaller (Linux)
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
shell: bash
run: | run: |
echo "Building Linux executable with PyInstaller" pyinstaller --onefile --hidden-import=pycryptodomex --hidden-import=fake_useragent \
pyinstaller --onefile --hidden-import=pycryptodomex --hidden-import=fake_useragent --hidden-import=qbittorrentapi \ --hidden-import=qbittorrentapi --hidden-import=qbittorrent --hidden-import=googlesearch \
--hidden-import=qbittorrent --hidden-import=googlesearch --hidden-import=bs4 --hidden-import=httpx \ --hidden-import=bs4 --hidden-import=httpx --hidden-import=rich --hidden-import=tqdm \
--hidden-import=rich --hidden-import=tqdm --hidden-import=m3u8 --hidden-import=psutil --hidden-import=unidecode \ --hidden-import=m3u8 --hidden-import=psutil --hidden-import=unidecode \
--hidden-import=jsbeautifier --hidden-import=pathvalidate --hidden-import=Cryptodome.Cipher \ --hidden-import=jsbeautifier --hidden-import=pathvalidate \
--hidden-import=Cryptodome.Cipher.AES --hidden-import=Cryptodome.Util --hidden-import=Cryptodome.Util.Padding \ --hidden-import=Cryptodome.Cipher --hidden-import=Cryptodome.Cipher.AES \
--hidden-import=Cryptodome.Random --hidden-import=Pillow --hidden-import=pyTelegramBotAPI \ --hidden-import=Cryptodome.Util --hidden-import=Cryptodome.Util.Padding \
--additional-hooks-dir=pyinstaller/hooks --add-data "StreamingCommunity:StreamingCommunity" \ --hidden-import=Cryptodome.Random --hidden-import=Pillow \
--name=StreamingCommunity test_run.py --hidden-import=pyTelegramBotAPI --additional-hooks-dir=pyinstaller/hooks \
--add-data "StreamingCommunity:StreamingCommunity" \
--name=StreamingCommunity test_run.py
- name: Upload executable (Windows) - name: Upload executable (Windows)
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@ -122,7 +124,7 @@ jobs:
- name: Create or update release - name: Create or update release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
tag_name: ${{ env.latest_tag }} # Usa l'ultimo tag come nome del release tag_name: ${{ env.latest_tag }}
files: | files: |
dist/StreamingCommunity.exe dist/StreamingCommunity.exe
dist/StreamingCommunity dist/StreamingCommunity