name: Build with PyInstaller on: workflow_dispatch: jobs: build: runs-on: windows-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: '3.11' - name: Cache Python dependencies uses: actions/cache@v4 with: path: C:\Users\runneradmin\AppData\Local\pip\Cache key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} restore-keys: | ${{ runner.os }}-pip- - name: Install dependencies run: | python -m pip install --upgrade pip 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: | 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@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 }}