diff --git a/.github/workflows/python311.yml b/.github/workflows/python311.yml new file mode 100644 index 0000000..144b65a --- /dev/null +++ b/.github/workflows/python311.yml @@ -0,0 +1,62 @@ +name: macOS + +on: [push] + +jobs: + build_app: + name: Build macOS application bundle + runs-on: macos-13 + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Use Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: 3.11 + + - name: Install the Apple certificate and provisioning profile + env: + BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} + P12_PASSWORD: ${{ secrets.P12_PASSWORD }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} + DEV_ID: ${{ secrets.DEV_ID }} + DEV_USERNAME: ${{ secrets.NOTARIZE_USERNAME }} + DEV_PASSWORD: ${{ secrets.NOTARIZE_PASSWORD }} + run: | + # create variables + CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 + PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision + KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db + + # import certificate and provisioning profile from secrets + touch $CERTIFICATE_PATH + echo -n "$BUILD_CERTIFICATE_BASE64" | base64 -d -o $CERTIFICATE_PATH + + # create temporary keychain + security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + security set-keychain-settings -lut 21600 $KEYCHAIN_PATH + security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + + # import certificate to keychain + security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH + security list-keychain -d user -s $KEYCHAIN_PATH + + # Create config file needed by release.py + echo "IDENTITY=$DEV_ID" >> macOS/IDs.sh + echo "USERNAME=$DEV_USERNAME" >> macOS/IDs.sh + echo "PASSWORD=$DEV_PASSWORD" >> macOS/IDs.sh + + - name: install bundle-app + run: | + python3.11 -m pip install bundle-app + + - name: assemble bundle + run: | + python3.11 build-mac-app.py + + - uses: actions/upload-artifact@v3 + with: + name: SnapPy.dmg + path: ./macOS/dmg-maker/SnapPy.dmg diff --git a/.github/workflows/macOS.yml b/.github/workflows/python312.yml similarity index 95% rename from .github/workflows/macOS.yml rename to .github/workflows/python312.yml index 799ddec..f2c7855 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/python312.yml @@ -50,11 +50,11 @@ jobs: - name: install bundle-app run: | - python3 -m pip install bundle-app + python3.12 -m pip install bundle-app - name: assemble bundle run: | - bash build-mac-app.sh + python3.12 build-mac-app.py - uses: actions/upload-artifact@v3 with: diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5c6cb93 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.pyc +__pycache__ +*.tgz +*.dmg +dist +IDs.sh diff --git a/build-mac-app.py b/build-mac-app.py new file mode 100644 index 0000000..42486cd --- /dev/null +++ b/build-mac-app.py @@ -0,0 +1,16 @@ +import sys +import os +from shutil import rmtree +from subprocess import check_call + +os.chdir('macOS') +app = os.path.join('snappy', 'SnapPy.app') +if os.path.exists(app): + rmtree(app) +check_call([sys.executable, 'bin/make-bundle.py']) +check_call(['/bin/bash', 'bin/sign-bundle.sh']) +if os.path.exists('dist'): + rmtree('dist') +os.renames('snappy/SnapPy.app', 'dist/SnapPy.app') +check_call(['/bin/bash', 'bin/notarize.sh']) + diff --git a/macOS/bin/make-bundle.py b/macOS/bin/make-bundle.py new file mode 100644 index 0000000..9a8dd08 --- /dev/null +++ b/macOS/bin/make-bundle.py @@ -0,0 +1,9 @@ +import sys +import os +import subprocess + +os.chdir('snappy') +subprocess.check_call([sys.executable, '-m', 'bundle_app.build']) +subprocess.check_call([sys.executable, '-m', 'bundle_app.add_packages']) +subprocess.check_call([sys.executable, '-m', 'bundle_app.streamline']) + diff --git a/macOS/bin/make-bundle.sh b/macOS/bin/make-bundle.sh deleted file mode 100644 index 571e289..0000000 --- a/macOS/bin/make-bundle.sh +++ /dev/null @@ -1,5 +0,0 @@ -pushd snappy -python3 -m bundle_app.build -python3 -m bundle_app.add_packages -python3 -m bundle_app.streamline -popd diff --git a/macOS/snappy/info.toml b/macOS/snappy/info.toml index c391225..0402ece 100644 --- a/macOS/snappy/info.toml +++ b/macOS/snappy/info.toml @@ -37,8 +37,16 @@ OSAScriptingDefinition = "SnapPy.sdef" CFBundleTypeExtensions = [ "py", ] CFBundleTypeMIMETypes = [ "application/x-python", ] CFBundleTypeOSTypes = [ "TEXT", "****", ] + CFBundleTypeRole = "Viewer" [[CFBundleDocumentTypes]] - CFBundleTypeName = "Plain text file" - CFBundleTypeExtensions = [ "txt", ] + CFBundleTypeName = "Triangulation" + CFBundleTypeExtensions = [ "tri", ] CFBundleTypeMIMETypes = [ "application/text", ] - CFBundleTypeOSTypes = [ "TEXT", "****", ] \ No newline at end of file + CFBundleTypeOSTypes = [ "TEXT", "****", ] + CFBundleTypeRole = "Viewer" +[[CFBundleDocumentTypes]] + CFBundleTypeName = "Link projection" + CFBundleTypeExtensions = [ "tri", ] + CFBundleTypeMIMETypes = [ "application/text", ] + CFBundleTypeOSTypes = [ "TEXT", "****", ] + CFBundleTypeRole = "Viewer" diff --git a/macOS/snappy/requirements.txt b/macOS/snappy/requirements.txt index 45d871b..f7aeb83 100644 --- a/macOS/snappy/requirements.txt +++ b/macOS/snappy/requirements.txt @@ -1,2 +1,2 @@ -snappy +snappy >=3.1.1 snappy-15-knots