Skip to content

cicd: update

cicd: update #15

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-windows-${{ github.ref_name }}.exe
asset_path: ./dist/watchcat-windows-${{ github.ref_name }}.exe
- os: ubuntu-latest
asset_name: watchcat-linux-${{ github.ref_name }}
asset_path: ./dist/watchcat-linux-${{ github.ref_name }}
- os: macos-latest
asset_name: watchcat-macos-${{ github.ref_name }}.dmg
asset_path: ./dist/watchcat-macos-${{ github.ref_name }}.dmg
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: |
if [ "${{ runner.os }}" = "Windows" ]; then
poetry run pyinstaller --clean --onefile --windowed --name watchcat-windows transparent_overlay/main.py
elif [ "${{ runner.os }}" = "Linux" ]; then
poetry run pyinstaller --clean --onefile --windowed --name watchcat-linux transparent_overlay/main.py
else
poetry run pyinstaller --clean --onefile --windowed --name watchcat-macos transparent_overlay/main.py
fi
shell: bash
- name: List dist directory
run: ls -la dist/
shell: bash
- name: Rename with version
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
mv "./dist/watchcat-windows.exe" "./dist/watchcat-windows-${{ github.ref_name }}.exe"
elif [ "${{ runner.os }}" = "Linux" ]; then
mv "./dist/watchcat-linux" "./dist/watchcat-linux-${{ github.ref_name }}"
else
mv "./dist/watchcat-macos" "./dist/watchcat-macos-${{ github.ref_name }}.dmg"
fi
shell: bash
- name: Upload Release Asset
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ./dist/watchcat-*-${{ github.ref_name }}*
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: ${{ matrix.asset_name }}
path: ./dist/watchcat-*-${{ github.ref_name }}*
if-no-files-found: error
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