Skip to content

Create main.yml

Create main.yml #4

name: Build PackyCode macOS app
on:
workflow_dispatch: {}
push:
tags:
- 'v*'
paths:
- '**'
jobs:
build-macos:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip
uses: actions/cache@v4
with:
path: |
~/Library/Caches/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip uninstall -y wheel || true
pip install -r requirements.txt
pip install py2app
- name: Ensure icon exists (fallback if missing)
shell: bash
run: |
set -euo pipefail
ICON=assets/icon.png
if [[ ! -f "$ICON" ]]; then
echo "[warn] $ICON not found. Generating a tiny placeholder icon..."
mkdir -p assets
python - <<'PY'
import base64, os

Check failure on line 46 in .github/workflows/packycode-macos.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/packycode-macos.yml

Invalid workflow file

You have an error in your yaml syntax on line 46
png_b64 = (
'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMB/ai4E4QAAAAASUVORK5CYII='
)
with open('assets/icon.png', 'wb') as f:
f.write(base64.b64decode(png_b64))
print('Wrote assets/icon.png (1x1 placeholder)')
PY
else
echo "[ok] Found $ICON"
fi
- name: Build .app
run: |
python setup.py py2app -q
- name: Archive app (zip)
run: |
cd dist
ditto -c -k --sequesterRsrc --keepParent PackyCode.app PackyCode-macOS.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PackyCode-macOS
path: |
dist/PackyCode-macOS.zip
- name: Create GitHub Release (on tag)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: |
dist/PackyCode-macOS.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}