Skip to content

Release Build

Release Build #13

Workflow file for this run

name: Release Build
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.11"]
include:
- os: windows-latest
asset_name: watchcat.exe
asset_path: dist/watchcat.exe
- os: ubuntu-latest
asset_name: watchcat-linux
asset_path: dist/watchcat
- os: macos-latest
asset_name: watchcat-macos
asset_path: dist/watchcat
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Cache Poetry
uses: actions/cache@v3
with:
path: |
~/.local/share/pypoetry
~/.cache/pypoetry
%APPDATA%\Python\poetry
%LOCALAPPDATA%\pypoetry
key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }}
- name: Cache PyInstaller build
uses: actions/cache@v3
with:
path: |
dist
build
key: ${{ runner.os }}-pyinstaller-${{ hashFiles('**/*.py') }}
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
if: runner.os != 'Windows'
- name: Install Poetry (Windows)
if: runner.os == 'Windows'
run: |
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
echo "$env:APPDATA\Python\Scripts" >> $env:GITHUB_PATH
- name: Configure Poetry
run: |
poetry config virtualenvs.in-project true
poetry config installer.parallel true
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y qt6-base-dev libasound2-dev portaudio19-dev python3-dev
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: poetry install --with dev,macos --no-interaction --no-root
- name: Install dependencies (Linux)
if: matrix.os == 'ubuntu-latest'
run: poetry install --with dev,linux --no-interaction --no-root
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: poetry install --with dev,windows --no-interaction --no-root
- name: Install project
run: poetry install --only-root
- name: Build with PyInstaller
run: |
poetry run pyinstaller --clean --onefile --windowed --name watchcat transparent_overlay/main.py
- name: Rename Linux/macOS binary
if: runner.os != 'Windows'
run: |
mv dist/watchcat "dist/${{ matrix.asset_name }}"
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ matrix.asset_path }}
draft: false
prerelease: ${{ contains(github.ref, '-alpha') || contains(github.ref, '-beta') || contains(github.ref, '-rc') }}
generate_release_notes: true
fail_on_unmatched_files: true
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: watchcat-${{ matrix.os }}
path: ${{ matrix.asset_path }}
create-release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: watchcat-*/*
draft: false
prerelease: false
generate_release_notes: true