Update build.yml

This commit is contained in:
None 2025-02-06 17:27:32 +01:00 committed by GitHub
parent 66e7d47685
commit 438adb2f4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,4 +1,4 @@
name: Build and Release with PyInstaller
name: Build with PyInstaller
on:
workflow_dispatch:
@ -9,7 +9,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
@ -17,9 +17,9 @@ jobs:
python-version: '3.11'
- name: Cache Python dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
path: C:\Users\runneradmin\AppData\Local\pip\Cache
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
@ -27,22 +27,54 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install fake-useragent==1.1.3
python -m pip install -r requirements.txt
python -m pip install fake-useragent==1.1.3 pyinstaller
- name: Build executable with PyInstaller
shell: bash
run: |
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="StreamingCommunity/Test/Media/62809003.ico" test_run.py
set -e
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="Test/Media/62809003.ico" test_run.py
- name: Verify build output
shell: bash
run: |
if [ ! -f "dist/StreamingCommunity.exe" ]; then
echo "Errore: il file dist/StreamingCommunity.exe non esiste!"
exit 1
fi
- name: Upload executable as artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: StreamingCommunity
path: dist/StreamingCommunity.exe
- name: Get latest tag from GitHub
id: get_latest_tag
shell: bash
run: |
TAG=$(curl -s https://api.github.com/repos/Arrowar/StreamingCommunity/releases/latest | jq -r '.tag_name')
if [[ "$TAG" == "null" || -z "$TAG" ]]; then
echo "Nessun tag trovato, impostazione di default a v1.0.0"
TAG="v1.0.0"
fi
echo "Latest tag: $TAG"
echo "latest_tag=$TAG" >> $GITHUB_ENV
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create or update GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.latest_tag }}
files: dist/StreamingCommunity.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}