diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddf3a8c..715e144 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: CI -on: [ push, pull_request ] +on: [push, pull_request, workflow_call] permissions: contents: read diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fa19cc6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,60 @@ +name: Release + +on: + push: + tags: + - "v*" + workflow_dispatch: + +jobs: + test: + name: Run tests + uses: Bzero/typstwriter/.github/workflows/ci.yml@master + + build-macos-dmg: + needs: test + runs-on: macos-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.13" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install . + pip install pyinstaller + + - name: Build macOS app with PyInstaller + run: | + pyinstaller typstwriter.spec + + - name: Install create-dmg + run: brew install create-dmg + + - name: Create DMG + run: | + create-dmg \ + --volname "Typstwriter" \ + --window-pos 200 120 \ + --window-size 600 400 \ + --icon-size 100 \ + --icon "typstwriter.app" 150 185 \ + --app-drop-link 450 185 \ + "typstwriter.dmg" \ + "dist/typstwriter.app" + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: | + typstwriter.dmg + tag_name: ${{ github.ref_name }} + name: Release ${{ github.ref_name }} + prerelease: false + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/typstwriter.spec b/typstwriter.spec new file mode 100644 index 0000000..f17bd6f --- /dev/null +++ b/typstwriter.spec @@ -0,0 +1,69 @@ +# -*- mode: python ; coding: utf-8 -*- + +a = Analysis( + ['typstwriter/typstwriter.py'], + pathex=[], + binaries=[], + datas=[ + ('typstwriter/icons', 'typstwriter/icons'), + ], + hiddenimports=[ + 'qtpy', + 'qtpy.QtCore', + 'qtpy.QtWidgets', + 'qtpy.QtGui', + 'PySide6', + 'PySide6.QtCore', + 'PySide6.QtWidgets', + 'PySide6.QtGui', + 'PySide6.QtPrintSupport', + 'typstwriter.logging', + 'typstwriter.arguments', + 'typstwriter.configuration', + 'typstwriter.globalstate', + 'typstwriter.mainwindow', + ], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + noarchive=False, + optimize=0, +) + +pyz = PYZ(a.pure) + +exe = EXE( + pyz, + a.scripts, + [], + exclude_binaries=True, + name='typstwriter', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + console=False, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +) + +coll = COLLECT( + exe, + a.binaries, + a.datas, + strip=False, + upx=True, + upx_exclude=[], + name='typstwriter', +) + +app = BUNDLE( + coll, + name='typstwriter.app', + icon=None, + bundle_identifier='net.posteo.b0.typstwriter', +) \ No newline at end of file