Skip to content

Release

Release #11

Workflow file for this run

name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write
jobs:
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build with PyInstaller
run: pyinstaller Mouser.spec --noconfirm
- name: Create archive
run: Compress-Archive -Path dist\Mouser -DestinationPath Mouser-Windows.zip
- uses: actions/upload-artifact@v4
with:
name: Mouser-Windows
path: Mouser-Windows.zip
build-macos:
name: build-macos (${{ matrix.name }})
strategy:
fail-fast: false
matrix:
include:
- name: Apple Silicon
runner: macos-15
python_architecture: arm64
pyinstaller_target_arch: arm64
artifact_name: Mouser-macOS
archive_name: Mouser-macOS.zip
- name: Intel
runner: macos-15-intel
python_architecture: x64
pyinstaller_target_arch: x86_64
artifact_name: Mouser-macOS-intel
archive_name: Mouser-macOS-intel.zip
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
architecture: ${{ matrix.python_architecture }}
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build macOS app
env:
PYINSTALLER_TARGET_ARCH: ${{ matrix.pyinstaller_target_arch }}
run: |
chmod +x build_macos_app.sh
./build_macos_app.sh
- name: Create archive
run: cd dist && zip -r -y "../${{ matrix.archive_name }}" Mouser.app
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.archive_name }}
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libhidapi-dev
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build with PyInstaller
run: pyinstaller Mouser-linux.spec --noconfirm
- name: Create archive
run: cd dist && zip -r -y ../Mouser-Linux.zip Mouser
- uses: actions/upload-artifact@v4
with:
name: Mouser-Linux
path: Mouser-Linux.zip
release:
if: startsWith(github.ref, 'refs/tags/')
needs: [build-windows, build-macos, build-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
- name: Create or update GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "${{ github.ref_name }}" --repo "${{ github.repository }}" > /dev/null 2>&1; then
# Release already exists — just upload the assets
gh release upload "${{ github.ref_name }}" \
--repo "${{ github.repository }}" \
--clobber \
Mouser-Windows/Mouser-Windows.zip \
Mouser-macOS/Mouser-macOS.zip \
Mouser-macOS-intel/Mouser-macOS-intel.zip \
Mouser-Linux/Mouser-Linux.zip
else
gh release create "${{ github.ref_name }}" \
--repo "${{ github.repository }}" \
--title "Mouser ${{ github.ref_name }}" \
--generate-notes \
Mouser-Windows/Mouser-Windows.zip \
Mouser-macOS/Mouser-macOS.zip \
Mouser-macOS-intel/Mouser-macOS-intel.zip \
Mouser-Linux/Mouser-Linux.zip
fi