diff --git a/.github/workflows/update-binary.yml b/.github/workflows/update-binary.yml index 1acb6fc..9b412bb 100644 --- a/.github/workflows/update-binary.yml +++ b/.github/workflows/update-binary.yml @@ -49,67 +49,25 @@ jobs: # Generate the stub app cd stub briefcase build macOS Xcode - # Since the project is producing generic stub binary, we can't provide - # any meaningful signing credentials in the Xcode project. Remove the - # signature from the stub binaries. - codesign --remove-signature "./build/console-stub/macos/xcode/build/Release/Console Stub.app/Contents/MacOS/Console Stub" - codesign --remove-signature "./build/gui-stub/macos/xcode/build/Release/GUI Stub.app/Contents/MacOS/GUI Stub" - echo "Move the binaries into the final location" - mv "./build/console-stub/macos/xcode/build/Release/Console Stub.app/Contents/MacOS/Console Stub" Console-Stub-${{ env.PYTHON_TAG }} - mv "./build/gui-stub/macos/xcode/build/Release/GUI Stub.app/Contents/MacOS/GUI Stub" GUI-Stub-${{ env.PYTHON_TAG }} - - name: Upload Stub Artefact - uses: actions/upload-artifact@v4.3.3 - with: - name: stub-${{ matrix.python-version }} - path: stub/*-Stub-${{ env.PYTHON_TAG }} + echo "Build console stub artefact" + mv "./build/console-stub/macos/xcode/build/Release/Console Stub.app/Contents/MacOS/Console Stub" Stub + codesign --remove-signature Stub + zip Console-Stub-${{ env.PYTHON_TAG }}-${{ steps.build-vars.outputs.BUILD_NUMBER }}.zip Stub - commit-stubs: - name: Commit stub binaries - needs: build-stubs - runs-on: macos-latest - steps: - - name: Set Build Variables + echo "Build GUI stub artefact" + mv "./build/gui-stub/macos/xcode/build/Release/GUI Stub.app/Contents/MacOS/GUI Stub" Stub + codesign --remove-signature Stub + zip Console-Stub-${{ env.PYTHON_TAG }}-${{ steps.build-vars.outputs.BUILD_NUMBER }}.zip Stub + + - name: Upload Release Asset to S3 env: - TAG_NAME: ${{ github.ref }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} run: | - export TAG=$(basename $TAG_NAME) - export BRIEFCASE_VERSION="${TAG%-*}" - export BUILD_NUMBER="${TAG#*-}" + python -m pip install -U pip + python -m pip install -U setuptools + python -m pip install awscli - echo "TAG=${TAG}" | tee -a $GITHUB_ENV - echo "BRIEFCASE_VERSION=${BRIEFCASE_VERSION}" | tee -a $GITHUB_ENV - echo "BUILD_NUMBER=${BUILD_NUMBER}" | tee -a $GITHUB_ENV - - if [ "${BRIEFCASE_VERSION}" == "dev" ]; then - # We're on the development template; push to main - echo "TEMPLATE_BRANCH=main" | tee -a $GITHUB_ENV - else - echo "TEMPLATE_BRANCH=v${BRIEFCASE_VERSION}" | tee -a $GITHUB_ENV - fi - - - name: Checkout Template - uses: actions/checkout@v4.1.6 - - - name: Download Stub Artefacts - uses: actions/download-artifact@v4.1.7 - with: - pattern: stub-* - path: stub - merge-multiple: true - - - name: Commit stubs - run: | - git config user.email "brutus@beeware.org" - git config user.name "Brutus (robot)" - # Move the binary into it's final location - mv stub/*-Stub-* "{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS" - # Ensure the binary is executable - cd "{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS" - chmod 755 *-Stub-* - # Commit changes - git add ./*-Stub-* - git commit -m "AUTO: Update app binaries; build ${{ env.TAG }}" - git push origin HEAD:${{ env.TEMPLATE_BRANCH }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + aws s3 cp stub/Console-Stub-${{ env.PYTHON_TAG }}-${{ steps.build-vars.outputs.BUILD_NUMBER }}.zip s3://briefcase-support/python/${{ steps.build-vars.outputs.PY_VERSION }}/macOS/Console-Stub-${{ env.PYTHON_TAG }}-${{ steps.build-vars.outputs.BUILD_NUMBER }}.zip + aws s3 cp stub/GUI-Stub-${{ env.PYTHON_TAG }}-${{ steps.build-vars.outputs.BUILD_NUMBER }}.zip s3://briefcase-support/python/${{ steps.build-vars.outputs.PY_VERSION }}/macOS/GUI-Stub-${{ env.PYTHON_TAG }}-${{ steps.build-vars.outputs.BUILD_NUMBER }}.zip diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index ebdd896..a7324c0 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -1,20 +1,5 @@ from pathlib import Path - -BIN_PATH = Path("{{ cookiecutter.formal_name }}.app/Contents/MacOS") - -# Rename the stub binary we want to "Stub"" -STUB_PATH = ( - BIN_PATH - / "{% if cookiecutter.console_app %}Console{% else %}GUI{% endif %}-Stub-{{ cookiecutter.python_version|py_tag }}" -) -STUB_PATH.rename(BIN_PATH / "Stub") - -# Delete all stubs that aren't for the Python version and app type -# that we are targeting -for stub in BIN_PATH.glob("*-Stub-*"): - stub.unlink() - # The codesign utility in recent macOS fails with obscure errors when presented with # CRLF line endings, but in some configurations (e.g. global `core.autocrlf=true`) # git may have checked out this repo in a way that put CRLF line endings in Entitlements.plist. @@ -24,6 +9,6 @@ xml_content = ENTITLEMENTS_PATH.read_text() ENTITLEMENTS_PATH.open('w', newline='\n').write(xml_content) -INFO_PATH = BIN_PATH.parent / 'Info.plist' +INFO_PATH = Path("{{ cookiecutter.formal_name }}.app/Contents/Info.plist") info_content = INFO_PATH.read_text() INFO_PATH.open('w', newline='\n').write(info_content) diff --git a/{{ cookiecutter.format }}/briefcase.toml b/{{ cookiecutter.format }}/briefcase.toml index 23d240d..c94ed8a 100644 --- a/{{ cookiecutter.format }}/briefcase.toml +++ b/{{ cookiecutter.format }}/briefcase.toml @@ -12,6 +12,7 @@ support_path = "{{ cookiecutter.formal_name }}.app/Contents/Resources/support" "3.11": "support_revision = 3", "3.12": "support_revision = 2", }.get(cookiecutter.python_version|py_tag, "") }} +stub_binary_revision = 8 cleanup_paths = [ "{{ cookiecutter.formal_name }}.app/Contents/Resources/support/Python.xcframework", "{{ cookiecutter.formal_name }}.app/Contents/Resources/support/platform-site", diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.10 b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.10 deleted file mode 100755 index 2aa64c9..0000000 Binary files a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.10 and /dev/null differ diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.11 b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.11 deleted file mode 100755 index ecac288..0000000 Binary files a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.11 and /dev/null differ diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.12 b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.12 deleted file mode 100755 index 734a286..0000000 Binary files a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.12 and /dev/null differ diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.8 b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.8 deleted file mode 100755 index 7614dbd..0000000 Binary files a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.8 and /dev/null differ diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.9 b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.9 deleted file mode 100755 index 4f39ea1..0000000 Binary files a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/Console-Stub-3.9 and /dev/null differ diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.10 b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.10 deleted file mode 100755 index 26b0ea5..0000000 Binary files a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.10 and /dev/null differ diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.11 b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.11 deleted file mode 100755 index 4ff2f34..0000000 Binary files a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.11 and /dev/null differ diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.12 b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.12 deleted file mode 100755 index 3f73c5b..0000000 Binary files a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.12 and /dev/null differ diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.8 b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.8 deleted file mode 100755 index c2fd8ba..0000000 Binary files a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.8 and /dev/null differ diff --git a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.9 b/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.9 deleted file mode 100755 index b85f748..0000000 Binary files a/{{ cookiecutter.format }}/{{ cookiecutter.formal_name }}.app/Contents/MacOS/GUI-Stub-3.9 and /dev/null differ