Merge pull request #12 from ozankaraali/dev #72
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Package App | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Check OpenSSL Version | |
run: python -c "import ssl; print(ssl.OPENSSL_VERSION)" | |
- name: Install VLC | |
run: sudo apt-get update && sudo apt-get install -y vlc | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Package App with PyInstaller for Linux | |
run: | | |
pip install pyinstaller | |
pyinstaller qitv-linux.spec | |
- name: Upload Linux artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packaged-app-linux | |
path: dist/qitv | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Check OpenSSL Version | |
run: python -c "import ssl; print(ssl.OPENSSL_VERSION)" | |
# - name: Install Chocolatey | |
# shell: powershell | |
# run: | | |
# Set-ExecutionPolicy Bypass -Scope Process -Force | |
# [System.Net.ServicePointManager]::SecurityProtocol = 'Tls12' | |
# iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) | |
- name: Install VLC using Chocolatey | |
run: choco install vlc -y | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Package App with PyInstaller for Windows | |
run: | | |
pip install pyinstaller | |
pyinstaller qitv-windows.spec | |
- name: Upload Windows artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packaged-app-windows | |
path: dist/qitv.exe | |
build-macos-universal: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Check OpenSSL Version | |
run: python -c "import ssl; print(ssl.OPENSSL_VERSION)" | |
- name: Install VLC | |
run: brew install --cask vlc | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Package App with PyInstaller for macOS | |
run: | | |
pip install pyinstaller | |
pyinstaller qitv-macos.spec | |
# - name: Rename the executable | |
# run: mv dist/qitv.app/Contents/MacOS/qitv dist/qitv.app/Contents/MacOS/qitv_cli | |
# - name: Create launcher script | |
# run: | | |
# printf '#!/bin/bash\nopen -n "$(dirname "$0")/qitv_cli"\n' > dist/qitv.app/Contents/MacOS/qitv | |
# chmod +x dist/qitv.app/Contents/MacOS/qitv | |
- name: Ad-Hoc Sign the app | |
run: codesign --force --deep --sign - dist/qitv.app | |
- name: Zip macOS App | |
run: | | |
cd dist | |
zip -r qitv-macos-universal.zip qitv.app | |
- name: Upload macOS artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packaged-app-macos-universal | |
path: dist/qitv-macos-universal.zip | |
build-macos-intel: | |
runs-on: macos-12 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Check OpenSSL Version | |
run: python -c "import ssl; print(ssl.OPENSSL_VERSION)" | |
- name: Install VLC | |
run: brew install --cask vlc | |
- name: Install dependencies | |
run: pip install -r requirements.txt | |
- name: Package App with PyInstaller for macOS (Intel) | |
run: | | |
pip install pyinstaller | |
pyinstaller qitv-macos.spec | |
# - name: Rename the executable | |
# run: mv dist/qitv.app/Contents/MacOS/qitv dist/qitv.app/Contents/MacOS/qitv_cli | |
# - name: Create launcher script | |
# run: | | |
# printf '#!/bin/bash\nopen -n "$(dirname "$0")/qitv_cli"\n' > dist/qitv.app/Contents/MacOS/qitv | |
# chmod +x dist/qitv.app/Contents/MacOS/qitv | |
- name: Ad-Hoc Sign the app | |
run: codesign --force --deep --sign - dist/qitv.app | |
- name: Zip macOS App | |
run: | | |
cd dist | |
zip -r qitv-macos-intel.zip qitv.app | |
- name: Upload macOS artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: packaged-app-macos-intel | |
path: dist/qitv-macos-intel.zip | |
release: | |
needs: [build-linux, build-windows, build-macos-universal, build-macos-intel] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Get Version | |
id: get_version | |
run: | | |
version=$(grep -oP '(?<=CURRENT_VERSION = ")[^"]*' config_manager.py) | |
echo "VERSION=$version" >> $GITHUB_ENV | |
- name: Get Previous Version | |
id: get_previous_version | |
run: | | |
previous_version=$(git tag --sort=-v:refname | head -n 2 | tail -n 1) | |
echo "PREVIOUS_VERSION=$previous_version" >> $GITHUB_ENV | |
- name: Generate Changelog | |
id: generate_changelog | |
run: | | |
echo "## Please always download this free software from [RELEASES](https://github.com/ozankaraali/QiTV/releases) instead of using others' distributions, which may have malware. Always keep the [original repository](https://github.com/ozankaraali/QiTV) for the reference." > changelog.md | |
echo "" >> changelog.md | |
echo "Security updates." >> changelog.md | |
echo "" >> changelog.md | |
echo "**Full Changelog**: https://github.com/ozankaraali/QiTV/compare/${{ env.PREVIOUS_VERSION }}...v${{ env.VERSION }}" >> changelog.md | |
echo "" >> changelog.md | |
echo "### Commits" >> changelog.md | |
echo "" >> changelog.md | |
git log --pretty=format:"- %s" ${{ env.PREVIOUS_VERSION }}...HEAD >> changelog.md | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
tag_name: v${{ env.VERSION }} | |
release_name: v${{ env.VERSION }} | |
body: ${{ steps.generate_changelog.outputs.changelog }} | |
draft: false | |
prerelease: true | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
- name: Upload Linux Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: packaged-app-linux/qitv | |
asset_name: qitv-linux | |
asset_content_type: application/octet-stream | |
- name: Upload Windows Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: packaged-app-windows/qitv.exe | |
asset_name: qitv-windows.exe | |
asset_content_type: application/octet-stream | |
- name: Upload macOS Universal Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: packaged-app-macos-universal/qitv-macos-universal.zip | |
asset_name: qitv-macos-universal.zip | |
asset_content_type: application/zip | |
- name: Upload macOS Intel Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: packaged-app-macos-intel/qitv-macos-intel.zip | |
asset_name: qitv-macos-intel.zip | |
asset_content_type: application/zip |