Skip to content

Use merge-multiple input of download-artifacts action #109

Use merge-multiple input of download-artifacts action

Use merge-multiple input of download-artifacts action #109

Workflow file for this run

name: Packaging
on:
push:
branches:
- main
- stable
- docs
- actions*
tags:
- v*
workflow_dispatch:
jobs:
build:
name: Build wheel and sdist
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build check-manifest
- name: Run check-manifest
run: |
python -m check_manifest
- name: Build
run: |
python -m build
- name: Upload built packages
uses: actions/upload-artifact@v4
with:
name: packages
path: dist/*
if-no-files-found: error
pyinstaller:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
name: PyInstaller • ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install package
shell: bash
run: |
python -m pip install --upgrade pip
pip install .
echo "PYGELLERMANN_VERSION=$(python -c 'import pygellermann; print(pygellermann.__version__)')" >> $GITHUB_ENV
- name: Install PyInstaller
run: |
pip install pyinstaller
- name: Run PyInstaller
shell: bash
run: |
pyinstaller --name PyGellermann --windowed --onefile scripts/pygellermann-gui.py
EXT="${{runner.os == 'Windows' && '.exe' || '' }}"
mv dist/PyGellermann$EXT dist/PyGellermann-$PYGELLERMANN_VERSION-${{ runner.os }}$EXT
- name: Package macOS App Bundle to DMG
if: runner.os == 'macOS'
run: |
brew install create-dmg
curl -O https://raw.githubusercontent.com/dmgbuild/dmgbuild/main/src/dmgbuild/resources/builtin-arrow.tiff
create-dmg \
--volname "PyGellermann" \
--background "builtin-arrow.tiff" \
--window-size 640 280 \
--icon-size 128 \
--icon "PyGellermann.app" 140 120 \
--hide-extension "PyGellermann.app" \
--app-drop-link 500 120 \
"dist/PyGellermann.dmg" \
"dist/PyGellermann.app/"
rm -r dist/PyGellermann.app
mv dist/PyGellermann.dmg dist/PyGellermann-$PYGELLERMANN_VERSION-${{ runner.os }}.dmg
- name: Upload built executable
uses: actions/upload-artifact@v4
with:
name: executable-${{ runner.os }}
path: dist/PyGellermann-*
if-no-files-found: error
create_release:
name: Create release
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v')
needs: [build, pyinstaller]
permissions:
contents: write
steps:
- name: Collect wheel, sdist, and executables
uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Upload wheel, sdist, and executables to release
uses: ncipollo/release-action@v1
with:
name: ${{ github.ref_name }}
draft: true
artifacts: dist/*
token: ${{ secrets.GITHUB_TOKEN }}