From 376ed23dccc42b8edc7a150630211d5284cd8090 Mon Sep 17 00:00:00 2001 From: KenCorma <37089104+KenCorma@users.noreply.github.com> Date: Wed, 4 Sep 2024 00:25:54 +0000 Subject: [PATCH] Reconcile Actions (#10) * Reconfigured debug and publish --- .github/actions/build/macos/comfy/action.yml | 22 ++++++------ .../actions/build/macos/notorize/action.yml | 0 .../actions/build/macos/signing/action.yml | 24 +++++++++++++ .github/actions/build/windows/app/action.yml | 4 +-- .github/workflows/debug_macos.yml | 25 +++++++++++-- .github/workflows/publish_macos.yml | 22 +++++------- .github/workflows/publish_windows.yml | 2 +- forge.config.ts | 36 ++++++++++--------- scripts/shim.sh | 2 ++ 9 files changed, 90 insertions(+), 47 deletions(-) delete mode 100644 .github/actions/build/macos/notorize/action.yml create mode 100644 .github/actions/build/macos/signing/action.yml diff --git a/.github/actions/build/macos/comfy/action.yml b/.github/actions/build/macos/comfy/action.yml index 9ce0661a..36f4c76b 100644 --- a/.github/actions/build/macos/comfy/action.yml +++ b/.github/actions/build/macos/comfy/action.yml @@ -3,19 +3,19 @@ description: Download, install, and set up Comfy runs: using: composite steps: - name: Install Python + - name: Install Python uses: actions/setup-python@v4 with: python-version: '3.12' - - name: Make Standalone - shell: sh - run: | - python -m pip install --upgrade pip - pip install comfy-cli - cd assets - comfy --skip-prompt --workspace ./ComfyUI install --fast-deps --m-series --skip-manager - comfy --workspace ./ComfyUI standalone --platform macos - comfy standalone --rehydrate - ls + - name: Make Standalone + shell: sh + run: | + python -m pip install --upgrade pip + pip install comfy-cli + cd assets + comfy --skip-prompt --workspace ./ComfyUI install --fast-deps --m-series --skip-manager + comfy --workspace ./ComfyUI standalone --platform macos + comfy standalone --rehydrate + ls # - name: Sign Wheels # uses: ./.github/actions/build/macos/signwheel \ No newline at end of file diff --git a/.github/actions/build/macos/notorize/action.yml b/.github/actions/build/macos/notorize/action.yml deleted file mode 100644 index e69de29b..00000000 diff --git a/.github/actions/build/macos/signing/action.yml b/.github/actions/build/macos/signing/action.yml new file mode 100644 index 00000000..93c6f431 --- /dev/null +++ b/.github/actions/build/macos/signing/action.yml @@ -0,0 +1,24 @@ +name: Setup Apple Signing +description: Setup everything to sign and notarize +inputes: + CERTIFICATE_OSX_APPLICATION: + required: true + type: string + CERTIFICATE_PASSWORD: + required: true + type: string +runs: + using: composite + steps: + - name: Add MacOS certs + shell: sh + run: cd scripts && chmod +x add-osx-cert.sh && ./add-osx-cert.sh + env: + CERTIFICATE_OSX_APPLICATION: ${{ inputs.CERTIFICATE_OSX_APPLICATION }} + CERTIFICATE_PASSWORD: ${{ inputs.CERTIFICATE_PASSWORD }} + - name: Set ID + shell: sh + run: | + SIGN_ID=$(security find-identity -p codesigning -v | grep -E "Developer ID" | sed -n -e 's/.* "/"/p' | tr -d '""') + echo "SIGN_ID=$SIGN_ID" >> $GITHUB_ENV + \ No newline at end of file diff --git a/.github/actions/build/windows/app/action.yml b/.github/actions/build/windows/app/action.yml index c75fa0d9..a34593b4 100644 --- a/.github/actions/build/windows/app/action.yml +++ b/.github/actions/build/windows/app/action.yml @@ -25,8 +25,8 @@ runs: run: | curl -L -o comfyui-win.7z https://github.com/Comfy-Org/python-dependencies/releases/download/embedded-windows-deps-cu11.8-py11.9-5/ComfyUI_windows_portable.7z 7z x comfyui-win.7z -odist/ - move dist/ComfyUI_windows_portable/ComfyUI assets/UI/ - move dist/ComfyUI_windows_portable/python_embedded assets/UI/ + move dist/ComfyUI_windows_portable/ComfyUI assets/ + move dist/ComfyUI_windows_portable/python_embedded assets/ cd assets/UI/ComfyUI && ls shell: cmd - name: Make app diff --git a/.github/workflows/debug_macos.yml b/.github/workflows/debug_macos.yml index b4d93278..63246816 100644 --- a/.github/workflows/debug_macos.yml +++ b/.github/workflows/debug_macos.yml @@ -9,6 +9,27 @@ jobs: build-macos: runs-on: macos-latest steps: - - name: Blank - run: echo "Intentionally left blank" + - name: Github checkout + uses: actions/checkout@v4 + - name: Declare some variables + run: | + echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" + shell: bash + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + - run: npm i + - name: Build Comfy + uses: ./.github/actions/build/macos/comfy + - name: Publish app + env: + PUBLISH: false + DEBUG: electron-forge* + run: npm run make -- --arch="arm64" + - name: Upload Build + uses: actions/upload-artifact@v4 + with: + name: comfyui-electron-debug-build-${{env.sha_short}} + path: out/make/zip/darwin/arm64/*.zip \ No newline at end of file diff --git a/.github/workflows/publish_macos.yml b/.github/workflows/publish_macos.yml index 600bdf6f..e002e400 100644 --- a/.github/workflows/publish_macos.yml +++ b/.github/workflows/publish_macos.yml @@ -1,5 +1,5 @@ -# .github/workflows/release.yml -name: Release app +# .github/workflows/publish_macos.yml +name: Release MacOS app on: workflow_dispatch: @@ -10,24 +10,18 @@ jobs: steps: - name: Github checkout uses: actions/checkout@v4 - - name: Output xcode version - run: xcodebuild -version - - name: Add MacOS certs - run: cd scripts && chmod +x add-osx-cert.sh && ./add-osx-cert.sh - env: - CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }} - CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} - name: Use Node.js uses: actions/setup-node@v4 with: node-version: 20 - run: npm i + - name: Set Up signing + uses: ./.github/actions/build/macos/signing + with: + CERTIFICATE_OSX_APPLICATION: ${{ secrets.CERTIFICATE_OSX_APPLICATION }} + CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} - name: Make Comfy - uses: ./.github/actions/build/macos/comfy - - run: | - SIGN_ID=$(security find-identity -p codesigning -v | grep -E "Developer ID" | sed -n -e 's/.* "/"/p' | tr -d '""') - echo "SIGN_ID=$SIGN_ID" >> $GITHUB_ENV - sed -i '' 's/packageOpts.quiet = true/packageOpts.quiet = false/g' "node_modules/@electron-forge/core/dist/api/package.js" + uses: ./.github/actions/build/macos/comfy - name: Sign Wheels uses: ./.github/actions/build/macos/signwheel - name: shim diff --git a/.github/workflows/publish_windows.yml b/.github/workflows/publish_windows.yml index 802e4bd9..abe79be8 100644 --- a/.github/workflows/publish_windows.yml +++ b/.github/workflows/publish_windows.yml @@ -1,4 +1,4 @@ -# .github/workflows/release.yml +# .github/workflows/publish_windows.yml name: Release Windows app on: diff --git a/forge.config.ts b/forge.config.ts index 9ad1a712..027d1c6d 100644 --- a/forge.config.ts +++ b/forge.config.ts @@ -11,26 +11,28 @@ import { FuseV1Options, FuseVersion } from '@electron/fuses'; const config: ForgeConfig = { packagerConfig: { asar: true, - ...process.env.PUBLISH == 'true' && {windowsSign: { - debug:true, - hookFunction: (filePath) => { - if (!filePath.endsWith("ComfyUI.exe")) return; // For now just ignore any file that isnt the main exe will need to change when building with installers/auto updates / a compiled python servesr - import("child_process").then(cp => cp.execSync(`signtool.exe sign /sha1 ${process.env.DIGICERT_FINGERPRINT} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 ${filePath}`)); + ...process.env.PUBLISH == 'true' && { + windowsSign: { + debug:true, + hookFunction: (filePath) => { + if (!filePath.endsWith("ComfyUI.exe")) return; // For now just ignore any file that isnt the main exe will need to change when building with installers/auto updates / a compiled python servesr + import("child_process").then(cp => cp.execSync(`signtool.exe sign /sha1 ${process.env.DIGICERT_FINGERPRINT} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 ${filePath}`)); + }, + }, + osxSign: { + identity: process.env.SIGN_ID, + optionsForFile: (filepath) => { + return { entitlements: './assets/entitlements.mac.plist' }; + } + }, + osxNotarize: { + appleId: process.env.APPLE_ID, + appleIdPassword: process.env.APPLE_PASSWORD, + teamId: process.env.APPLE_TEAM_ID }, - }}, - osxSign: { - identity: process.env.SIGN_ID, - optionsForFile: (filepath) => { - console.log('~'); - return { entitlements: './assets/entitlements.mac.plist' }; - } }, extraResource: ['./assets/UI', './assets/ComfyUI', process.platform === 'darwin' ? './assets/python' : './assets/python.tgz'], - osxNotarize: { - appleId: process.env.APPLE_ID, - appleIdPassword: process.env.APPLE_PASSWORD, - teamId: process.env.APPLE_TEAM_ID - }, + }, rebuildConfig: {}, hooks: { diff --git a/scripts/shim.sh b/scripts/shim.sh index 2061d6c9..07468352 100644 --- a/scripts/shim.sh +++ b/scripts/shim.sh @@ -1 +1,3 @@ cp -f scripts/shims/utils.js node_modules/@electron/osx-sign/dist/cjs/util.js + +sed -i '' 's/packageOpts.quiet = true/packageOpts.quiet = false/g' "node_modules/@electron-forge/core/dist/api/package.js" \ No newline at end of file