Build and Create Release #23
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 Create Release | |
on: | |
push: | |
tags: | |
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | |
workflow_dispatch: | |
jobs: | |
build-and-release: | |
name: Build and Release | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
include: | |
- os: ubuntu-latest | |
TARGET: linux | |
CMD_BUILD: pyinstaller --noconfirm --console --onefile --name SenPY --icon icon.ico --hidden-import plyer.platforms.linux.notification --add-data="icon.ico:." main.py | |
OUT_FILE_NAME: SenPY | |
ASSET_MIME: application/x-executable | |
- os: windows-latest | |
TARGET: windows | |
CMD_BUILD: pyinstaller --noconfirm --console --onefile --name SenPY.exe --icon icon.ico --hidden-import plyer.platforms.win.notification --add-data="icon.ico:." main.py | |
OUT_FILE_NAME: SenPY.exe | |
ASSET_MIME: application/vnd.microsoft.portable-executable | |
- os: macos-latest | |
TARGET: macos | |
CMD_BUILD: pyinstaller --noconfirm --console --onefile --name SenPY-mac --icon icon.ico --hidden-import plyer.platforms.macosx.notification --add-data="icon.ico:." main.py | |
OUT_FILE_NAME: SenPY-mac | |
ASSET_MIME: application/x-mach-binary | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Git | |
run: | | |
git config user.name "github-actions" | |
git config user.email "github-actions@github.com" | |
- name: Install GitHub CLI | |
if: matrix.os == 'ubuntu-latest' | |
run: sudo apt-get install gh -y | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Build with pyinstaller for ${{ matrix.TARGET }} | |
run: ${{ matrix.CMD_BUILD }} | |
- name: Create Release | |
if: matrix.os == 'ubuntu-latest' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
TAG_NAME=${{ github.ref_name }} | |
echo "Creating release for tag: $TAG_NAME" | |
gh release create $TAG_NAME --generate-notes --title "Release $TAG_NAME" --draft | |
- name: Upload Release Asset | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release upload ${{ github.ref_name }} ./dist/${{ matrix.OUT_FILE_NAME }} --clobber |