From 0568db48ecc9958bfb2f63eea243dd96f6373aa1 Mon Sep 17 00:00:00 2001 From: Djuri Baars Date: Sun, 9 Jun 2024 23:23:06 +0200 Subject: [PATCH] Add macOS workflow and spec --- .github/workflows/build_macos.yaml | 51 +++++++++++++++++++ ...uild_artifacts.yaml => build_windows.yaml} | 2 +- BTClockOTA-universal.spec | 45 ++++++++++++++++ 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build_macos.yaml rename .github/workflows/{build_artifacts.yaml => build_windows.yaml} (97%) create mode 100644 BTClockOTA-universal.spec diff --git a/.github/workflows/build_macos.yaml b/.github/workflows/build_macos.yaml new file mode 100644 index 0000000..46731af --- /dev/null +++ b/.github/workflows/build_macos.yaml @@ -0,0 +1,51 @@ +name: Build macOS artifacts and make release + +on: workflow_dispatch + +jobs: + build-windows: + runs-on: + - ubuntu-latest + permissions: + contents: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Download universal2 Python + run: | + curl -o python.pkg https://www.python.org/ftp/python/3.12.4/python-3.12.4-macos11.pkg + - name: Install Python + run: | + sudo installer -pkg python.pkg -target / + - name: Add Python to PATH + run: | + echo "/Library/Frameworks/Python.framework/Versions/3.12/bin" >> $GITHUB_PATH + - name: Verify Python installation + run: | + python3 --version + pip3 --version + - name: Install dependencies + run: | + pip3 install --upgrade pip + pip3 install pyinstaller + pip3 install -r requirements.txt + - name: Build with PyInstaller + run: | + pyinstaller BTClockOTA-universal.spec + - name: Get current block + id: getBlockHeight + run: echo "blockHeight=$(curl -s https://mempool.space/api/blocks/tip/height)" >> $GITHUB_OUTPUT + - name: Archive artifacts + uses: actions/upload-artifact@v4 + with: + name: macos-artifacts + path: dist/ + - name: Create release + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.getBlockHeight.outputs.blockHeight }} + commit: main + name: release-${{ steps.getBlockHeight.outputs.blockHeight }} + artifacts: "dist/**" + allowUpdates: true + makeLatest: true diff --git a/.github/workflows/build_artifacts.yaml b/.github/workflows/build_windows.yaml similarity index 97% rename from .github/workflows/build_artifacts.yaml rename to .github/workflows/build_windows.yaml index 22f5206..cfbdaeb 100644 --- a/.github/workflows/build_artifacts.yaml +++ b/.github/workflows/build_windows.yaml @@ -1,4 +1,4 @@ -name: Build artifacts and make release +name: Build Windows artifacts and make release on: workflow_dispatch diff --git a/BTClockOTA-universal.spec b/BTClockOTA-universal.spec new file mode 100644 index 0000000..4a0929c --- /dev/null +++ b/BTClockOTA-universal.spec @@ -0,0 +1,45 @@ +# -*- mode: python ; coding: utf-8 -*- + + +a = Analysis( + ['app.py'], + pathex=[], + binaries=[], + datas=[], + hiddenimports=['zeroconf._utils.ipaddress', + 'zeroconf._handlers.answers', 'pyserial', 'wx'], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + noarchive=False, + optimize=0, +) +pyz = PYZ(a.pure) + +exe = EXE( + pyz, + a.scripts, + a.binaries, + a.datas, + [], + name='BTClockOTA', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=False, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch="universal2", + codesign_identity=None, + entitlements_file=None, + icon=['update-icon.ico'], +) + +app = BUNDLE(exe, + name='BTClockOTA.app', + icon='update-icon.icns', + bundle_identifier=None)