Compare commits
	
		
			118 Commits
		
	
	
		
			jtran/plus
			...
			pierremtb/
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| e41976e666 | |||
| 430d756041 | |||
| 5f8eb0ddc9 | |||
| 64c19e5089 | |||
| 689685c0ee | |||
| 76f1e7a164 | |||
| ee7f6e457b | |||
| 5941bbcf23 | |||
| d10abefbc5 | |||
| 5deff7614f | |||
| b8896127c8 | |||
| e9bdbec725 | |||
| 0d6d67ec2c | |||
| c4eca5f126 | |||
| b01bc589ab | |||
| 94799d18c2 | |||
| 9d9135c0ce | |||
| 27ed8cbf1c | |||
| 6edb37bb4d | |||
| fa07fe3265 | |||
| dac9886991 | |||
| 32a293e985 | |||
| 4ac668445b | |||
| aa83b9b870 | |||
| 6117ba9d19 | |||
| 0e708a6c0f | |||
| e4e8b4e156 | |||
| 98d667fe0c | |||
| 57bc35f4b6 | |||
| e8c858a40e | |||
| 5f4159a863 | |||
| 3b5b0b8f4e | |||
| 3c01597263 | |||
| 8d3b069f14 | |||
| 112c374ece | |||
| 4fe32057f1 | |||
| b66c27d8a1 | |||
| f4fb042104 | |||
| 11c821d0ce | |||
| 151f1876f9 | |||
| 249710987d | |||
| 8dc1461f3c | |||
| ebabd59471 | |||
| 92b15e72cc | |||
| acf9299dd0 | |||
| afe7fd25df | |||
| 1d99cfda74 | |||
| cd21c47384 | |||
| e9f61e8e97 | |||
| cb6c450654 | |||
| 40ac5c5fe5 | |||
| 8ce5ebaca6 | |||
| 9bb291aca9 | |||
| 6ca61c0fa4 | |||
| 79d1a1c255 | |||
| 8b83f70139 | |||
| abccb62b01 | |||
| 45e6fbc858 | |||
| 8670dc5fc7 | |||
| 3cb3b76728 | |||
| 3e9882655d | |||
| dc8c5c16cb | |||
| 95a2724463 | |||
| ae821bfc77 | |||
| c537f90878 | |||
| 6c5234261c | |||
| f73f790db0 | |||
| 711d2cc5b3 | |||
| 7d743bf4ca | |||
| b980497b4d | |||
| aafec0b800 | |||
| c86e03810b | |||
| 0926e83855 | |||
| 093a1aa3b3 | |||
| d9f9caea19 | |||
| e84a38bf00 | |||
| e81b7dc9b8 | |||
| 005a5d450a | |||
| a37078ca0f | |||
| 93f726f6f9 | |||
| d7403c111d | |||
| e0eb254453 | |||
| e2d68c6ca2 | |||
| 7aff054c95 | |||
| c75ba0cf8f | |||
| ed5d107103 | |||
| 59ce76c145 | |||
| 24a9e70cd7 | |||
| 84faf82696 | |||
| 8123a34a02 | |||
| ce5ee57b8c | |||
| 395ff8db68 | |||
| 2ed1ff0168 | |||
| ec6321d457 | |||
| db8acb67c5 | |||
| e1fb2e3435 | |||
| 1acab35d15 | |||
| 3dee4b91f6 | |||
| aa2b18f3ac | |||
| c71956e14e | |||
| f56caee20e | |||
| 2d17860dd5 | |||
| 0175da92a3 | |||
| cd3a60781e | |||
| a98664c7a9 | |||
| e91361cc19 | |||
| ae2189d97f | |||
| e42f3d7afd | |||
| 0b1a8c2349 | |||
| 61b4aa2dc5 | |||
| a76db7a177 | |||
| ce4c0340e8 | |||
| 1ad197b558 | |||
| 0a998beaf9 | |||
| e1dcc86f9d | |||
| bb8ba08b6a | |||
| fba2c2ea26 | |||
| 3670deeab3 | 
							
								
								
									
										386
									
								
								.github/workflows/build-publish-apps.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										386
									
								
								.github/workflows/build-publish-apps.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,386 @@ | ||||
| name: build-publish-apps | ||||
|  | ||||
| on: | ||||
|   pull_request: | ||||
|   push: | ||||
|     branches: | ||||
|       - main | ||||
|   release: | ||||
|     types: [published] | ||||
|   schedule: | ||||
|     - cron: '0 4 * * *' | ||||
|   # Daily at 04:00 AM UTC | ||||
|   # Will checkout the last commit from the default branch (main as of 2023-10-04) | ||||
|  | ||||
| env: | ||||
|   CUT_RELEASE_PR: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.title, 'Cut release v')) }} | ||||
|   BUILD_RELEASE: true | ||||
|   BUCKET_NAME: 'dl.kittycad.io' | ||||
|   BUCKET_FOLDER: 'releases/modeling-app/test/electron' | ||||
|   WEBSITE_DIR: 'dl.zoo.dev/releases/modeling-app/test/electron'  | ||||
|   GOOGLE_CLOUD_PROJECT_ID: 'kittycadapi' | ||||
|  | ||||
| # concurrency: | ||||
| #   group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||||
| #   cancel-in-progress: true | ||||
|  | ||||
| jobs: | ||||
|   prepare-files: | ||||
|     runs-on: ubuntu-22.04  # seperate job on Ubuntu for easy string manipulations (compared to Windows) | ||||
|     outputs: | ||||
|       version: ${{ steps.export_version.outputs.version }} | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|  | ||||
|       - uses: actions/setup-node@v4 | ||||
|         with: | ||||
|           node-version-file: '.nvmrc' | ||||
|           cache: 'yarn' | ||||
|  | ||||
|       - run: yarn install | ||||
|  | ||||
|       - name: Setup Rust | ||||
|         uses: dtolnay/rust-toolchain@stable | ||||
|  | ||||
|       - uses: Swatinem/rust-cache@v2 | ||||
|         with: | ||||
|           workspaces: './src/wasm-lib' | ||||
|  | ||||
|       # TODO: see if we can fetch from main instead if no diff at src/wasm-lib | ||||
|       - name: Run build:wasm | ||||
|         run: "yarn build:wasm${{ env.BUILD_RELEASE == 'true' && '-dev' || ''}}" | ||||
|  | ||||
|       - name: Set nightly version | ||||
|         if: github.event_name == 'schedule' | ||||
|         run: | | ||||
|           VERSION=$(date +'%-y.%-m.%-d') yarn bump-jsons | ||||
|  | ||||
|       # TODO: see if we need to inject updater nightly URL here https://dl.zoo.dev/releases/modeling-app/nightly/last_update.json | ||||
|       # TODO: see if we ned to add updater test URL here https://dl.zoo.dev/releases/modeling-app/updater-test/last_update.json | ||||
|  | ||||
|       - uses: actions/upload-artifact@v3 | ||||
|         with: | ||||
|           name: prepared-files | ||||
|           path: | | ||||
|             package.json | ||||
|             src/wasm-lib/pkg/wasm_lib* | ||||
|  | ||||
|       - id: export_version | ||||
|         run: echo "version=`cat package.json | jq -r '.version'`" >> "$GITHUB_OUTPUT" | ||||
|  | ||||
|  | ||||
|   build-apps: | ||||
|     needs: [prepare-files] | ||||
|     strategy: | ||||
|       fail-fast: false | ||||
|       matrix: | ||||
|         os: [macos-14, windows-2022, ubuntu-22.04] | ||||
|     runs-on: ${{ matrix.os }} | ||||
|     env: | ||||
|       APPLE_ID: ${{ secrets.APPLE_ID }} | ||||
|       APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | ||||
|       APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | ||||
|       APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | ||||
|       CSC_LINK: ${{ secrets.APPLE_CERTIFICATE }} | ||||
|       CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | ||||
|       CSC_KEYCHAIN: ${{ secrets.APPLE_SIGNING_IDENTITY }} | ||||
|       CSC_FOR_PULL_REQUEST: true | ||||
|       WINDOWS_CERTIFICATE_THUMBPRINT: F4C9A52FF7BC26EE5E054946F6B11DEEA94C748D | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|  | ||||
|       - uses: actions/download-artifact@v3 | ||||
|         name: prepared-files | ||||
|  | ||||
|       - name: Copy prepared files | ||||
|         run: | | ||||
|           ls -R prepared-files | ||||
|           cp prepared-files/package.json package.json | ||||
|           cp prepared-files/src/wasm-lib/pkg/wasm_lib_bg.wasm public | ||||
|           mkdir src/wasm-lib/pkg | ||||
|           cp prepared-files/src/wasm-lib/pkg/wasm_lib* src/wasm-lib/pkg | ||||
|  | ||||
|       - name: Sync node version and setup cache | ||||
|         uses: actions/setup-node@v4 | ||||
|         with: | ||||
|           node-version-file: '.nvmrc' | ||||
|           cache: 'yarn' # Set this to npm, yarn or pnpm. | ||||
|  | ||||
|       - run: yarn install | ||||
|  | ||||
|       - run: yarn tronb:vite | ||||
|  | ||||
|       - name: Prepare certificate and variables (Windows only) | ||||
|         if: ${{ env.BUILD_RELEASE == 'true' && matrix.os == 'windows-2022' }} | ||||
|         run: | | ||||
|           echo "${{secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12 | ||||
|           cat /d/Certificate_pkcs12.p12 | ||||
|           echo "::set-output name=version::${GITHUB_REF#refs/tags/v}" | ||||
|           echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV" | ||||
|           echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV" | ||||
|           echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV" | ||||
|           echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV" | ||||
|           echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH | ||||
|           echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH | ||||
|           echo "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" >> $GITHUB_PATH | ||||
|         shell: bash | ||||
|  | ||||
|       - name: Setup certicate with SSM KSP (Windows only) | ||||
|         if: ${{ env.BUILD_RELEASE == 'true' && matrix.os == 'windows-2022' }} | ||||
|         run: | | ||||
|           curl -X GET  https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o smtools-windows-x64.msi | ||||
|           msiexec /i smtools-windows-x64.msi /quiet /qn | ||||
|           smksp_registrar.exe list | ||||
|           smctl.exe keypair ls | ||||
|           C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user | ||||
|           smksp_cert_sync.exe | ||||
|         shell: cmd | ||||
|  | ||||
|       - name: Build the app | ||||
|         # if: ${{ env.BUILD_RELEASE == 'false' }} | ||||
|         run: yarn electron-builder --config --publish always | ||||
|  | ||||
|       - name: List artifacts in out/ | ||||
|         run: ls -R out | ||||
|  | ||||
|       - name: Prepare the tauri update bundles (macOS) | ||||
|         if: false | ||||
|         env: | ||||
|           TAURI_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | ||||
|           TAURI_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | ||||
|           # VERSION: ${{ github.event_name == 'release' && format('v{0}', needs.prepare-files.outputs.version) || needs.prepare-files.outputs.version }} | ||||
|           VERSION: ${{ format('v{0}', needs.prepare-files.outputs.version) }} | ||||
|         run: | | ||||
|           for ARCH in arm64 x64; do | ||||
|             TAURI_DIR=out/tauri/$VERSION/macos | ||||
|             TEMP_DIR=temp/$ARCH | ||||
|             mkdir -p $TAURI_DIR | ||||
|             mkdir -p $TEMP_DIR | ||||
|             unzip out/*-$ARCH-mac.zip -d $TEMP_DIR | ||||
|             tar -czvf "$TAURI_DIR/Zoo Modeling App-$ARCH.app.tar.gz" -C $TEMP_DIR "Zoo Modeling App.app"  | ||||
|             yarn tauri signer sign "$TAURI_DIR/Zoo Modeling App-$ARCH.app.tar.gz" | ||||
|           done | ||||
|           ls -R out | ||||
|  | ||||
|       - name: Prepare the tauri update bundles (Windows) | ||||
|         if: false | ||||
|         env: | ||||
|           TAURI_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | ||||
|           TAURI_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | ||||
|           # VERSION: ${{ github.event_name == 'release' && format('v{0}', needs.prepare-files.outputs.version) || needs.prepare-files.outputs.version }} | ||||
|           VERSION_NO_V: ${{ needs.prepare-files.outputs.version }} | ||||
|           VERSION: ${{ format('v{0}', needs.prepare-files.outputs.version) }} | ||||
|         run: | | ||||
|           $env:TAURI_DIR="out/tauri/${env:VERSION}/nsis" | ||||
|           mkdir -p ${env:TAURI_DIR} | ||||
|           $env:OUT_FILE="${env:TAURI_DIR}/Zoo Modeling App_${env:VERSION_NO_V}_x64-setup.nsis.zip" | ||||
|           7z a -mm=Copy "${env:OUT_FILE}" ./out/*-x64-win.exe | ||||
|           yarn tauri signer sign "${env:OUT_FILE}" | ||||
|           ls -R out | ||||
|  | ||||
|       - uses: actions/upload-artifact@v3 | ||||
|         with: | ||||
|           name: out-${{ matrix.os }} | ||||
|           path: | | ||||
|             out/Zoo*.* | ||||
|             out/latest*.yml | ||||
|             out/tauri | ||||
|  | ||||
|       # TODO: add the 'Build for Mac TestFlight (nightly)' stage back | ||||
|  | ||||
|       # TODO: add the updater tests back | ||||
|  | ||||
|  | ||||
|   publish-apps-release: | ||||
|     runs-on: ubuntu-22.04 | ||||
|     permissions: | ||||
|       contents: write | ||||
|     if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }} | ||||
|     needs: [prepare-files, build-apps] | ||||
|     env: | ||||
|       VERSION_NO_V: ${{ needs.prepare-files.outputs.version }} | ||||
|       # VERSION: ${{ github.event_name == 'release' && format('v{0}', needs.prepare-files.outputs.version) || needs.prepare-files.outputs.version }} | ||||
|       VERSION: ${{ format('v{0}', needs.prepare-files.outputs.version) }} | ||||
|       PUB_DATE: ${{ github.event_name == 'release' && github.event.release.created_at || github.event.repository.updated_at }} | ||||
|       # NOTES: ${{ github.event_name == 'release' && github.event.release.body || format('Nightly build, commit {0}', github.sha) }} | ||||
|       NOTES: ${{ format('Electron build, commit {0}', github.sha) }} | ||||
|       # BUCKET_DIR: ${{ github.event_name == 'release' && 'dl.kittycad.io/releases/modeling-app' || 'dl.kittycad.io/releases/modeling-app/nightly' }} | ||||
|       BUCKET_DIR: ${{ 'dl.kittycad.io/releases/modeling-app/test/electron-builder' }} | ||||
|       BUCKET_DIR_TAURI: ${{ 'dl.kittycad.io/releases/modeling-app/test/electron-builder/tauri' }} | ||||
|       # WEBSITE_DIR: ${{ github.event_name == 'release' && 'dl.zoo.dev/releases/modeling-app' || 'dl.zoo.dev/releases/modeling-app/nightly' }} | ||||
|       WEBSITE_DIR: ${{ 'dl.zoo.dev/releases/modeling-app/test/electron-builder' }} | ||||
|       WEBSITE_DIR_TAURI: ${{ 'dl.zoo.dev/releases/modeling-app/test/electron-builder/tauri' }} | ||||
|       # URL_CODED_NAME: ${{ github.event_name == 'schedule' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }} | ||||
|       URL_CODED_NAME: ${{ 'Zoo%20Modeling%20App' }} | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|  | ||||
|       - uses: actions/download-artifact@v3 | ||||
|         with: | ||||
|           name: out-windows-2022 | ||||
|           path: out | ||||
|  | ||||
|       - uses: actions/download-artifact@v3 | ||||
|         with: | ||||
|           name: out-macos-14 | ||||
|           path: out | ||||
|  | ||||
|       - uses: actions/download-artifact@v3 | ||||
|         with: | ||||
|           name: out-ubuntu-22.04 | ||||
|           path: out | ||||
|        | ||||
|       - name: Generate the download static endpoint | ||||
|         run: | | ||||
|           RELEASE_DIR=https://${WEBSITE_DIR} | ||||
|           jq --null-input \ | ||||
|             --arg version "${VERSION}" \ | ||||
|             --arg pub_date "${PUB_DATE}" \ | ||||
|             --arg notes "${NOTES}" \ | ||||
|             --arg mac_arm64_url "$RELEASE_DIR/${{ env.URL_CODED_NAME }}-${VERSION_NO_V}-arm64-mac.dmg" \ | ||||
|             --arg mac_x64_url "$RELEASE_DIR/${{ env.URL_CODED_NAME }}-${VERSION_NO_V}-x64-mac.dmg" \ | ||||
|             --arg windows_arm64_url "$RELEASE_DIR/${{ env.URL_CODED_NAME }}-${VERSION_NO_V}-arm64-win.msi" \ | ||||
|             --arg windows_x64_url "$RELEASE_DIR/${{ env.URL_CODED_NAME }}-${VERSION_NO_V}-x64-win.msi" \ | ||||
|             '{ | ||||
|               "version": $version, | ||||
|               "pub_date": $pub_date, | ||||
|               "notes": $notes, | ||||
|               "platforms": { | ||||
|                 "dmg-arm64": { | ||||
|                   "url": $mac_arm64_url | ||||
|                 }, | ||||
|                 "dmg-x64": { | ||||
|                   "url": $mac_x64_url | ||||
|                 }, | ||||
|                 "msi-arm64": { | ||||
|                   "url": $windows_arm64_url | ||||
|                 }, | ||||
|                 "msi-x64": { | ||||
|                   "url": $windows_x64_url | ||||
|                 } | ||||
|               } | ||||
|             }' > last_download.json | ||||
|             cat last_download.json | ||||
|  | ||||
|       - name: Generate the update static endpoint for tauri | ||||
|         if: false | ||||
|         run: | | ||||
|           TAURI_DIR=out/tauri/$VERSION | ||||
|           MAC_ARM64_SIG=`cat $TAURI_DIR/macos/*-arm64.app.tar.gz.sig` | ||||
|           MAC_X64_SIG=`cat $TAURI_DIR/macos/*-x64.app.tar.gz.sig` | ||||
|           WINDOWS_SIG=`cat $TAURI_DIR/nsis/*.nsis.zip.sig` | ||||
|           RELEASE_DIR=https://${WEBSITE_DIR_TAURI}/${VERSION} | ||||
|           jq --null-input \ | ||||
|             --arg version "${VERSION}" \ | ||||
|             --arg pub_date "${PUB_DATE}" \ | ||||
|             --arg notes "${NOTES}" \ | ||||
|             --arg mac_arm64_sig "$MAC_ARM64_SIG" \ | ||||
|             --arg mac_arm64_url "$RELEASE_DIR/macos/${{ env.URL_CODED_NAME }}-arm64.app.tar.gz" \ | ||||
|             --arg mac_x64_sig "$MAC_X64_SIG" \ | ||||
|             --arg mac_x64_url "$RELEASE_DIR/macos/${{ env.URL_CODED_NAME }}-x64.app.tar.gz" \ | ||||
|             --arg windows_sig "$WINDOWS_SIG" \ | ||||
|             --arg windows_url "$RELEASE_DIR/nsis/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_x64-setup.nsis.zip" \ | ||||
|             '{ | ||||
|               "version": $version, | ||||
|               "pub_date": $pub_date, | ||||
|               "notes": $notes, | ||||
|               "platforms": { | ||||
|                 "darwin-x86_64": { | ||||
|                   "signature": $mac_x64_sig, | ||||
|                   "url": $mac_x64_url | ||||
|                 }, | ||||
|                 "darwin-aarch64": { | ||||
|                   "signature": $mac_arm64_sig, | ||||
|                   "url": $mac_arm64_url | ||||
|                 }, | ||||
|                 "windows-x86_64": { | ||||
|                   "signature": $windows_sig, | ||||
|                   "url": $windows_url | ||||
|                 } | ||||
|               } | ||||
|             }' > last_update.json | ||||
|             cat last_update.json | ||||
|  | ||||
|       - name: List artifacts | ||||
|         run: "ls -R out" | ||||
|  | ||||
|       - name: Authenticate to Google Cloud | ||||
|         uses: 'google-github-actions/auth@v2.1.5' | ||||
|         with: | ||||
|           credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}' | ||||
|  | ||||
|       - name: Set up Google Cloud SDK | ||||
|         uses: google-github-actions/setup-gcloud@v2.1.0 | ||||
|         with: | ||||
|           project_id: ${{ env.GOOGLE_CLOUD_PROJECT_ID }} | ||||
|  | ||||
|       - name: Upload release files to public bucket | ||||
|         uses: google-github-actions/upload-cloud-storage@v2.1.3 | ||||
|         with: | ||||
|           path: out | ||||
|           glob: 'Zoo*' | ||||
|           parent: false | ||||
|           destination: ${{ env.BUCKET_DIR }} | ||||
|  | ||||
|       - name: Upload update endpoint to public bucket | ||||
|         uses: google-github-actions/upload-cloud-storage@v2.1.3 | ||||
|         with: | ||||
|           path: out | ||||
|           glob: 'latest*' | ||||
|           parent: false | ||||
|           destination: ${{ env.BUCKET_DIR }}  | ||||
|  | ||||
|       - name: Upload download endpoint to public bucket | ||||
|         uses: google-github-actions/upload-cloud-storage@v2.1.3 | ||||
|         with: | ||||
|           path: last_download.json | ||||
|           destination: ${{ env.BUCKET_DIR }} | ||||
|  | ||||
|       - name: Upload release files to public bucket for tauri | ||||
|         if: false | ||||
|         uses: google-github-actions/upload-cloud-storage@v2.1.1 | ||||
|         with: | ||||
|           path: "out/tauri/${{ env.VERSION }}"  | ||||
|           glob: '*/Zoo*' | ||||
|           parent: false | ||||
|           destination: ${{ env.BUCKET_DIR_TAURI }}/${{ env.VERSION }} | ||||
|  | ||||
|       - name: Upload update endpoint to public bucket for tauri | ||||
|         if: false | ||||
|         uses: google-github-actions/upload-cloud-storage@v2.1.1 | ||||
|         with: | ||||
|           path: last_update.json | ||||
|           destination: ${{ env.BUCKET_DIR_TAURI }} | ||||
|  | ||||
|       - name: Upload release files to Github | ||||
|         if: ${{ github.event_name == 'release' }} | ||||
|         uses: softprops/action-gh-release@v2 | ||||
|         with: | ||||
|           files: 'artifact/*/Zoo*' | ||||
|  | ||||
|       # TODO: Add GitHub publisher | ||||
|  | ||||
|   announce_release: | ||||
|     needs: [publish-apps-release] | ||||
|     runs-on: ubuntu-22.04 | ||||
|     if: github.event_name == 'release' | ||||
|     steps: | ||||
|       - name: Check out code | ||||
|         uses: actions/checkout@v4 | ||||
|  | ||||
|       - name: Set up Python | ||||
|         uses: actions/setup-python@v5 | ||||
|         with: | ||||
|           python-version: '3.x' | ||||
|  | ||||
|       - name: Install dependencies | ||||
|         run: | | ||||
|           python -m pip install --upgrade pip | ||||
|           pip install requests | ||||
|  | ||||
|       - name: Announce Release | ||||
|         env: | ||||
|           DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | ||||
|           RELEASE_VERSION: ${{ github.event.release.tag_name }} | ||||
|           RELEASE_BODY: ${{ github.event.release.body}} | ||||
|         run: python public/announce_release.py | ||||
							
								
								
									
										406
									
								
								.github/workflows/build-test-publish-apps.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										406
									
								
								.github/workflows/build-test-publish-apps.yml
									
									
									
									
										vendored
									
									
								
							| @ -1,406 +0,0 @@ | ||||
| name: build-test-publish-apps | ||||
|  | ||||
| on: | ||||
|   pull_request: | ||||
|   push: | ||||
|     branches: | ||||
|       - main | ||||
|   release: | ||||
|     types: [published] | ||||
|   schedule: | ||||
|     - cron: '0 4 * * *' | ||||
|   # Daily at 04:00 AM UTC | ||||
|   # Will checkout the last commit from the default branch (main as of 2023-10-04) | ||||
|  | ||||
| env: | ||||
|   CUT_RELEASE_PR: ${{ github.event_name == 'pull_request' && (contains(github.event.pull_request.title, 'Cut release v')) }} | ||||
|   BUILD_RELEASE: ${{ github.event_name == 'release' || github.event_name == 'schedule' || github.event_name == 'pull_request' && (contains(github.event.pull_request.title, 'Cut release v')) }} | ||||
|  | ||||
| concurrency: | ||||
|   group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||||
|   cancel-in-progress: true | ||||
|  | ||||
| jobs: | ||||
|   prepare-json-files: | ||||
|     runs-on: ubuntu-22.04  # seperate job on Ubuntu for easy string manipulations (compared to Windows) | ||||
|     outputs: | ||||
|       version: ${{ steps.export_version.outputs.version }} | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|  | ||||
|       - uses: actions/setup-node@v4 | ||||
|         with: | ||||
|           node-version-file: '.nvmrc' | ||||
|           cache: 'yarn' | ||||
|  | ||||
|       - name: Set nightly version | ||||
|         if: github.event_name == 'schedule' | ||||
|         run: | | ||||
|           VERSION=$(date +'%-y.%-m.%-d') yarn bump-jsons | ||||
|  | ||||
|       # TODO: see if we need to inject updater nightly URL here https://dl.zoo.dev/releases/modeling-app/nightly/last_update.json | ||||
|       # TODO: see if we ned to add updater test URL here https://dl.zoo.dev/releases/modeling-app/updater-test/last_update.json | ||||
|  | ||||
|       - uses: actions/upload-artifact@v3 | ||||
|         if: ${{ github.event_name == 'schedule' || env.CUT_RELEASE_PR == 'true' }} | ||||
|         with: | ||||
|           path: | | ||||
|             package.json | ||||
|  | ||||
|       - id: export_version | ||||
|         run: echo "version=`cat package.json | jq -r '.version'`" >> "$GITHUB_OUTPUT" | ||||
|  | ||||
|  | ||||
|   build-test-app-macos: | ||||
|     needs: [prepare-json-files] | ||||
|     runs-on: macos-14 | ||||
|     env: | ||||
|       APPLE_ID: ${{ secrets.APPLE_ID }} | ||||
|       APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} | ||||
|       APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | ||||
|       APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} | ||||
|       APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} | ||||
|       APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|  | ||||
|       - uses: actions/download-artifact@v3 | ||||
|         if: github.event_name == 'schedule' | ||||
|  | ||||
|       - name: Copy updated .json files | ||||
|         if: github.event_name == 'schedule' | ||||
|         run: | | ||||
|           ls -l artifact | ||||
|           cp artifact/package.json package.json | ||||
|  | ||||
|       - name: Sync node version and setup cache | ||||
|         uses: actions/setup-node@v4 | ||||
|         with: | ||||
|           node-version-file: '.nvmrc' | ||||
|           cache: 'yarn' # Set this to npm, yarn or pnpm. | ||||
|  | ||||
|       - run: yarn install | ||||
|  | ||||
|       - name: Setup Rust | ||||
|         uses: dtolnay/rust-toolchain@stable | ||||
|  | ||||
|       - uses: Swatinem/rust-cache@v2 | ||||
|         with: | ||||
|           workspaces: './src/wasm-lib' | ||||
|  | ||||
|       - name: Run build:wasm | ||||
|         run: "yarn build:wasm${{ env.BUILD_RELEASE == 'true' && '-dev' || ''}}" | ||||
|  | ||||
|       # TODO: sign the app (and updater bundle potentially) | ||||
|       - name: Add signing certificate | ||||
|         if: ${{ env.BUILD_RELEASE == 'true' }} | ||||
|         run: chmod +x add-osx-cert.sh && ./add-osx-cert.sh | ||||
|  | ||||
|       - name: Build the app for arm64 | ||||
|         run: "yarn electron-forge make" | ||||
|  | ||||
|       - name: Build the app for x64 | ||||
|         run: "yarn electron-forge make --arch x64" | ||||
|  | ||||
|       - name: List artifacts | ||||
|         run: "ls -R out/make" | ||||
|  | ||||
|       # TODO: add the 'Build for Mac TestFlight (nightly)' stage back | ||||
|  | ||||
|       - uses: actions/upload-artifact@v3 | ||||
|         with: | ||||
|           path: "out/make/*/*/*/*" | ||||
|  | ||||
|  | ||||
|   build-test-app-windows: | ||||
|     needs: [prepare-json-files] | ||||
|     runs-on: windows-2022 | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|  | ||||
|       - uses: actions/download-artifact@v3 | ||||
|  | ||||
|       - name: Copy updated .json files | ||||
|         if: github.event_name == 'schedule' | ||||
|         run: | | ||||
|           ls -l artifact | ||||
|           cp artifact/package.json package.json | ||||
|  | ||||
|       - name: Sync node version and setup cache | ||||
|         uses: actions/setup-node@v4 | ||||
|         with: | ||||
|           node-version-file: '.nvmrc' | ||||
|           cache: 'yarn' # Set this to npm, yarn or pnpm. | ||||
|  | ||||
|       - run: yarn install | ||||
|  | ||||
|       - name: Setup Rust | ||||
|         uses: dtolnay/rust-toolchain@stable | ||||
|  | ||||
|       - uses: Swatinem/rust-cache@v2 | ||||
|         with: | ||||
|           workspaces: './src/wasm-lib' | ||||
|  | ||||
|       - name: Run build:wasm manually | ||||
|         shell: bash | ||||
|         env: | ||||
|           MODE: ${{ env.BUILD_RELEASE == 'true' && '--release' || '--debug' }} | ||||
|         run: | | ||||
|           mkdir src/wasm-lib/pkg; cd src/wasm-lib | ||||
|           echo "building with ${{ env.MODE }}" | ||||
|           npx wasm-pack build --target web --out-dir pkg ${{ env.MODE }} | ||||
|           cd ../../ | ||||
|           cp src/wasm-lib/pkg/wasm_lib_bg.wasm public | ||||
|  | ||||
|       - name: Prepare certificate and variables (Windows only) | ||||
|         if: ${{ env.BUILD_RELEASE == 'true' }} | ||||
|         run: | | ||||
|           echo "${{secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12 | ||||
|           cat /d/Certificate_pkcs12.p12 | ||||
|           echo "::set-output name=version::${GITHUB_REF#refs/tags/v}" | ||||
|           echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV" | ||||
|           echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV" | ||||
|           echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV" | ||||
|           echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV" | ||||
|           echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH | ||||
|           echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH | ||||
|           echo "C:\Program Files\DigiCert\DigiCert One Signing Manager Tools" >> $GITHUB_PATH | ||||
|         shell: bash | ||||
|  | ||||
|       - name: Setup certicate with SSM KSP (Windows only) | ||||
|         if: ${{ env.BUILD_RELEASE == 'true' }} | ||||
|         run: | | ||||
|           curl -X GET  https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o smtools-windows-x64.msi | ||||
|           msiexec /i smtools-windows-x64.msi /quiet /qn | ||||
|           smksp_registrar.exe list | ||||
|           smctl.exe keypair ls | ||||
|           C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user | ||||
|           smksp_cert_sync.exe | ||||
|         shell: cmd | ||||
|  | ||||
|       - name: Build the app for x64 | ||||
|         run: "yarn electron-forge make --arch x64" | ||||
|  | ||||
|       - name: Build the app for arm64 | ||||
|         run: "yarn electron-forge make --arch arm64" | ||||
|  | ||||
|       - name: List artifacts | ||||
|         run: "ls -R out/make" | ||||
|  | ||||
|       - name: Sign using Signtool | ||||
|         if: ${{ env.BUILD_RELEASE == 'true' }} | ||||
|         env: | ||||
|           THUMBPRINT: "F4C9A52FF7BC26EE5E054946F6B11DEEA94C748D" | ||||
|           X64_FILE: "D:\\a\\modeling-app\\modeling-app\\out\\make\\squirrel.windows\\x64\\Zoo Modeling App-*Setup.exe" | ||||
|           ARM64_FILE: "D:\\a\\modeling-app\\modeling-app\\out\\make\\squirrel.windows\\arm64\\Zoo Modeling App-*Setup.exe" | ||||
|         run: | | ||||
|           signtool.exe sign /sha1 ${{ env.THUMBPRINT }} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 "${{ env.X64_FILE }}" | ||||
|           signtool.exe verify /v /pa "${{ env.X64_FILE }}" | ||||
|           signtool.exe sign /sha1 ${{ env.THUMBPRINT }} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 "${{ env.ARM64_FILE }}" | ||||
|           signtool.exe verify /v /pa "${{ env.ARM64_FILE }}" | ||||
|  | ||||
|       - uses: actions/upload-artifact@v3 | ||||
|         with: | ||||
|           path: "out/make/*/*/*" | ||||
|  | ||||
|       # TODO: Run e2e tests | ||||
|  | ||||
|  | ||||
|   build-test-app-ubuntu: | ||||
|     needs: [prepare-json-files] | ||||
|     runs-on: ubuntu-22.04 | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|  | ||||
|       - uses: actions/download-artifact@v3 | ||||
|         if: github.event_name == 'schedule' | ||||
|  | ||||
|       - name: Copy updated .json files | ||||
|         if: github.event_name == 'schedule' | ||||
|         run: | | ||||
|           ls -l artifact | ||||
|           cp artifact/package.json package.json | ||||
|  | ||||
|       - name: Sync node version and setup cache | ||||
|         uses: actions/setup-node@v4 | ||||
|         with: | ||||
|           node-version-file: '.nvmrc' | ||||
|           cache: 'yarn' # Set this to npm, yarn or pnpm. | ||||
|  | ||||
|       - run: yarn install | ||||
|  | ||||
|       - name: Setup Rust | ||||
|         uses: dtolnay/rust-toolchain@stable | ||||
|  | ||||
|       - uses: Swatinem/rust-cache@v2 | ||||
|         with: | ||||
|           workspaces: './src/wasm-lib' | ||||
|  | ||||
|       - name: Run build:wasm | ||||
|         run: "yarn build:wasm${{ env.BUILD_RELEASE == 'true' && '-dev' || ''}}" | ||||
|  | ||||
|       - name: Build the app for arm64 | ||||
|         run: "yarn electron-forge make --arch arm64" | ||||
|  | ||||
|       - name: Build the app for x64 | ||||
|         run: "yarn electron-forge make --arch x64" | ||||
|  | ||||
|       - name: List artifacts | ||||
|         run: "ls -R out/make" | ||||
|  | ||||
|       # TODO: add the 'Build for Mac TestFlight (nightly)' stage back | ||||
|  | ||||
|       # TODO: sign the app (and updater bundle potentially) | ||||
|  | ||||
|       - uses: actions/upload-artifact@v3 | ||||
|         with: | ||||
|           path: "out/make/*/*/*" | ||||
|  | ||||
|  | ||||
|   publish-apps-release: | ||||
|     runs-on: ubuntu-22.04 | ||||
|     permissions: | ||||
|       contents: write | ||||
|     if: ${{ github.event_name == 'release' || github.event_name == 'schedule' }} | ||||
|     needs: [prepare-json-files, build-test-app-macos, build-test-app-windows, build-test-app-ubuntu] | ||||
|     env: | ||||
|       VERSION_NO_V: ${{ needs.prepare-json-files.outputs.version }} | ||||
|       VERSION: ${{ github.event_name == 'release' && format('v{0}', needs.prepare-json-files.outputs.version) || needs.prepare-json-files.outputs.version }} | ||||
|       PUB_DATE: ${{ github.event_name == 'release' && github.event.release.created_at || github.event.repository.updated_at }} | ||||
|       NOTES: ${{ github.event_name == 'release' && github.event.release.body || format('Nightly build, commit {0}', github.sha) }} | ||||
|       BUCKET_DIR: ${{ github.event_name == 'release' && 'dl.kittycad.io/releases/modeling-app' || 'dl.kittycad.io/releases/modeling-app/nightly' }} | ||||
|       WEBSITE_DIR: ${{ github.event_name == 'release' && 'dl.zoo.dev/releases/modeling-app' || 'dl.zoo.dev/releases/modeling-app/nightly' }} | ||||
|       URL_CODED_NAME: ${{ github.event_name == 'schedule' && 'Zoo%20Modeling%20App%20%28Nightly%29' || 'Zoo%20Modeling%20App' }} | ||||
|     steps: | ||||
|       - uses: actions/download-artifact@v3 | ||||
|  | ||||
|       - name: Generate the update static endpoint | ||||
|         run: | | ||||
|           ls -l artifact/*/*oo* | ||||
|           DARWIN_SIG=`cat artifact/macos/*.app.tar.gz.sig` | ||||
|           WINDOWS_X86_64_SIG=`cat artifact/msi/*x64*.msi.zip.sig` | ||||
|           WINDOWS_AARCH64_SIG=`cat artifact/msi/*arm64*.msi.zip.sig` | ||||
|           RELEASE_DIR=https://${WEBSITE_DIR}/${VERSION} | ||||
|           jq --null-input \ | ||||
|             --arg version "${VERSION}" \ | ||||
|             --arg pub_date "${PUB_DATE}" \ | ||||
|             --arg notes "${NOTES}" \ | ||||
|             --arg darwin_sig "$DARWIN_SIG" \ | ||||
|             --arg darwin_url "$RELEASE_DIR/macos/${{ env.URL_CODED_NAME }}.app.tar.gz" \ | ||||
|             --arg windows_x86_64_sig "$WINDOWS_X86_64_SIG" \ | ||||
|             --arg windows_x86_64_url "$RELEASE_DIR/msi/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_x64_en-US.msi.zip" \ | ||||
|             --arg windows_aarch64_sig "$WINDOWS_AARCH64_SIG" \ | ||||
|             --arg windows_aarch64_url "$RELEASE_DIR/msi/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_arm64_en-US.msi.zip" \ | ||||
|             '{ | ||||
|               "version": $version, | ||||
|               "pub_date": $pub_date, | ||||
|               "notes": $notes, | ||||
|               "platforms": { | ||||
|                 "darwin-x86_64": { | ||||
|                   "signature": $darwin_sig, | ||||
|                   "url": $darwin_url | ||||
|                 }, | ||||
|                 "darwin-aarch64": { | ||||
|                   "signature": $darwin_sig, | ||||
|                   "url": $darwin_url | ||||
|                 }, | ||||
|                 "windows-x86_64": { | ||||
|                   "signature": $windows_x86_64_sig, | ||||
|                   "url": $windows_x86_64_url | ||||
|                 }, | ||||
|                 "windows-aarch64": { | ||||
|                   "signature": $windows_aarch64_sig, | ||||
|                   "url": $windows_aarch64_url | ||||
|                 } | ||||
|               } | ||||
|             }' > last_update.json | ||||
|             cat last_update.json | ||||
|  | ||||
|       - name: Generate the download static endpoint | ||||
|         run: | | ||||
|           RELEASE_DIR=https://${WEBSITE_DIR}/${VERSION} | ||||
|           jq --null-input \ | ||||
|             --arg version "${VERSION}" \ | ||||
|             --arg pub_date "${PUB_DATE}" \ | ||||
|             --arg notes "${NOTES}" \ | ||||
|             --arg darwin_url "$RELEASE_DIR/dmg/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_universal.dmg" \ | ||||
|             --arg windows_x86_64_url "$RELEASE_DIR/msi/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_x64_en-US.msi" \ | ||||
|             --arg windows_aarch64_url "$RELEASE_DIR/msi/${{ env.URL_CODED_NAME }}_${VERSION_NO_V}_arm64_en-US.msi" \ | ||||
|             '{ | ||||
|               "version": $version, | ||||
|               "pub_date": $pub_date, | ||||
|               "notes": $notes, | ||||
|               "platforms": { | ||||
|                 "dmg-universal": { | ||||
|                   "url": $darwin_url | ||||
|                 }, | ||||
|                 "msi-x86_64": { | ||||
|                   "url": $windows_x86_64_url | ||||
|                 }, | ||||
|                 "msi-aarch64": { | ||||
|                   "url": $windows_aarch64_url | ||||
|                 } | ||||
|               } | ||||
|             }' > last_download.json | ||||
|             cat last_download.json | ||||
|  | ||||
|       - name: Authenticate to Google Cloud | ||||
|         uses: 'google-github-actions/auth@v2.1.5' | ||||
|         with: | ||||
|           credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}' | ||||
|  | ||||
|       - name: Set up Google Cloud SDK | ||||
|         uses: google-github-actions/setup-gcloud@v2.1.0 | ||||
|         with: | ||||
|           project_id: kittycadapi | ||||
|  | ||||
|       - name: Upload release files to public bucket | ||||
|         uses: google-github-actions/upload-cloud-storage@v2.1.3 | ||||
|         with: | ||||
|           path: artifact | ||||
|           glob: '*/Zoo*' | ||||
|           parent: false | ||||
|           destination: ${{ env.BUCKET_DIR }}/${{ env.VERSION }} | ||||
|  | ||||
|       - name: Upload update endpoint to public bucket | ||||
|         uses: google-github-actions/upload-cloud-storage@v2.1.3 | ||||
|         with: | ||||
|           path: last_update.json | ||||
|           destination: ${{ env.BUCKET_DIR }} | ||||
|  | ||||
|       - name: Upload download endpoint to public bucket | ||||
|         uses: google-github-actions/upload-cloud-storage@v2.1.3 | ||||
|         with: | ||||
|           path: last_download.json | ||||
|           destination: ${{ env.BUCKET_DIR }} | ||||
|  | ||||
|       - name: Upload release files to Github | ||||
|         if: ${{ github.event_name == 'release' }} | ||||
|         uses: softprops/action-gh-release@v2 | ||||
|         with: | ||||
|           files: 'artifact/*/Zoo*' | ||||
|  | ||||
|   announce_release: | ||||
|     needs: [publish-apps-release] | ||||
|     runs-on: ubuntu-22.04 | ||||
|     if: github.event_name == 'release' | ||||
|     steps: | ||||
|       - name: Check out code | ||||
|         uses: actions/checkout@v4 | ||||
|  | ||||
|       - name: Set up Python | ||||
|         uses: actions/setup-python@v5 | ||||
|         with: | ||||
|           python-version: '3.x' | ||||
|  | ||||
|       - name: Install dependencies | ||||
|         run: | | ||||
|           python -m pip install --upgrade pip | ||||
|           pip install requests | ||||
|  | ||||
|       - name: Announce Release | ||||
|         env: | ||||
|           DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} | ||||
|           RELEASE_VERSION: ${{ github.event.release.tag_name }} | ||||
|           RELEASE_BODY: ${{ github.event.release.body}} | ||||
|         run: python public/announce_release.py | ||||
| @ -1,24 +0,0 @@ | ||||
| #!/usr/bin/env sh | ||||
| # From https://dev.to/rwwagner90/signing-electron-apps-with-github-actions-4cof | ||||
|  | ||||
| KEY_CHAIN=build.keychain | ||||
| CERTIFICATE_P12=certificate.p12 | ||||
|  | ||||
| # Recreate the certificate from the secure environment variable | ||||
| echo $APPLE_CERTIFICATE | base64 --decode > $CERTIFICATE_P12 | ||||
|  | ||||
| #create a keychain | ||||
| security create-keychain -p actions $KEY_CHAIN | ||||
|  | ||||
| # Make the keychain the default so identities are found | ||||
| security default-keychain -s $KEY_CHAIN | ||||
|  | ||||
| # Unlock the keychain | ||||
| security unlock-keychain -p actions $KEY_CHAIN | ||||
|  | ||||
| security import $CERTIFICATE_P12 -k $KEY_CHAIN -P $APPLE_CERTIFICATE_PASSWORD -T /usr/bin/codesign; | ||||
|  | ||||
| security set-key-partition-list -S apple-tool:,apple: -s -k actions $KEY_CHAIN | ||||
|  | ||||
| # remove certs | ||||
| rm -fr *.p12 | ||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 33 KiB | 
							
								
								
									
										65
									
								
								electron-builder.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										65
									
								
								electron-builder.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,65 @@ | ||||
| appId: dev.zoo.modeling-app | ||||
|  | ||||
| directories: | ||||
|   output: out | ||||
|   buildResources: assets | ||||
|  | ||||
| files: | ||||
|   - .vite/** | ||||
|  | ||||
| mac: | ||||
|   category: public.app-category.developer-tools | ||||
|   artifactName: "${productName}-${version}-${arch}-${os}.${ext}" | ||||
|   target: | ||||
|     - target: dmg  | ||||
|       arch: | ||||
|         - x64 | ||||
|         - arm64 | ||||
|     - target: zip  | ||||
|       arch: | ||||
|         - x64 | ||||
|         - arm64 | ||||
|   notarize: | ||||
|     teamId: 92H8YB3B95 | ||||
|  | ||||
| win: | ||||
|   artifactName: "${productName}-${version}-${arch}-${os}.${ext}" | ||||
|   target: | ||||
|     - target: nsis | ||||
|       arch: | ||||
|         - x64 | ||||
|         - arm64 | ||||
|     - target: msi | ||||
|       arch: | ||||
|         - x64 | ||||
|         - arm64 | ||||
|   signingHashAlgorithms: | ||||
|     - sha256 | ||||
|   sign: "./sign-win.js" | ||||
|   publisherName: "KittyCAD Inc" | ||||
|   icon: "assets/icon.ico" | ||||
|  | ||||
| msi: | ||||
|   oneClick: false | ||||
|   perMachine: true | ||||
|  | ||||
| nsis: | ||||
|   oneClick: false | ||||
|   perMachine: true | ||||
|   allowElevation: true | ||||
|   license: "LICENSE" | ||||
|   installerIcon: "assets/icon.ico" | ||||
|   include: "./installer.nsh" | ||||
|  | ||||
| linux: | ||||
|   artifactName: "${productName}-${version}-${arch}-${os}.${ext}" | ||||
|   target: | ||||
|     - target: appImage | ||||
|       arch: | ||||
|         - x64 | ||||
|         - arm64 | ||||
|  | ||||
| publish: | ||||
|   - provider: generic | ||||
|     url: https://dl.zoo.dev/releases/modeling-app/test/electron-builder | ||||
|     channel: latest | ||||
							
								
								
									
										8
									
								
								installer.nsh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								installer.nsh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | ||||
| !macro preInit | ||||
| 	SetRegView 64 | ||||
| 	WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\Zoo Modeling App" | ||||
| 	WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\Zoo Modeling App" | ||||
| 	SetRegView 32 | ||||
| 	WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\Zoo Modeling App" | ||||
| 	WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\Zoo Modeling App" | ||||
| !macroend | ||||
							
								
								
									
										10
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								package.json
									
									
									
									
									
								
							| @ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "zoo-modeling-app", | ||||
|   "version": "0.24.12", | ||||
|   "version": "0.24.100", | ||||
|   "private": true, | ||||
|   "productName": "Zoo Modeling App", | ||||
|   "author": { | ||||
| @ -39,6 +39,7 @@ | ||||
|     "codemirror": "^6.0.1", | ||||
|     "decamelize": "^6.0.0", | ||||
|     "electron-squirrel-startup": "^1.0.1", | ||||
|     "electron-updater": "^6.2.1", | ||||
|     "fuse.js": "^7.0.0", | ||||
|     "html2canvas-pro": "^1.5.8", | ||||
|     "isomorphic-fetch": "^3.0.0", | ||||
| @ -97,7 +98,9 @@ | ||||
|     "tron:package": "electron-forge package", | ||||
|     "tron:make": "electron-forge make", | ||||
|     "tron:publish": "electron-forge publish", | ||||
|     "tron:test": "NODE_ENV=development yarn playwright test --config=playwright.electron.config.ts --grep=@electron" | ||||
|     "tron:test": "NODE_ENV=development yarn playwright test --config=playwright.electron.config.ts --grep=@electron", | ||||
|     "tronb:vite": "vite build -c vite.main.config.ts && vite build -c vite.preload.config.ts && vite build -c vite.renderer.config.ts", | ||||
|     "tronb:package": "electron-builder --config" | ||||
|   }, | ||||
|   "prettier": { | ||||
|     "trailingComma": "es5", | ||||
| @ -134,6 +137,7 @@ | ||||
|     "@iarna/toml": "^2.2.5", | ||||
|     "@lezer/generator": "^1.7.1", | ||||
|     "@playwright/test": "^1.46.1", | ||||
|     "@tauri-apps/cli": "^2.0.0-rc.9", | ||||
|     "@testing-library/jest-dom": "^5.14.1", | ||||
|     "@testing-library/react": "^15.0.2", | ||||
|     "@types/d3-force": "^3.0.10", | ||||
| @ -161,6 +165,8 @@ | ||||
|     "autoprefixer": "^10.4.19", | ||||
|     "d3-force": "^3.0.0", | ||||
|     "electron": "^32.0.1", | ||||
|     "electron-builder": "^24.13.3", | ||||
|     "electron-notarize": "^1.2.2", | ||||
|     "eslint": "^8.0.1", | ||||
|     "eslint-config-react-app": "^7.0.1", | ||||
|     "eslint-plugin-css-modules": "^2.12.0", | ||||
|  | ||||
							
								
								
									
										38
									
								
								sign-win.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								sign-win.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,38 @@ | ||||
| // From https://github.com/OpenBuilds/OpenBuilds-CONTROL/blob/4800540ffaa517925fc2cff26670809efa341ffe/signWin.js | ||||
| const { execSync } = require('node:child_process') | ||||
|  | ||||
| exports.default = async (configuration) => { | ||||
|   if (!process.env.SM_API_KEY) { | ||||
|     console.error( | ||||
|       'Signing using signWin.js script: failed: SM_API_KEY ENV VAR NOT FOUND' | ||||
|     ) | ||||
|     return | ||||
|   } | ||||
|  | ||||
|   if (!process.env.WINDOWS_CERTIFICATE_THUMBPRINT) { | ||||
|     console.error( | ||||
|       'Signing using signWin.js script: failed: FINGERPRINT ENV VAR NOT FOUND' | ||||
|     ) | ||||
|     return | ||||
|   } | ||||
|  | ||||
|   if (!configuration.path) { | ||||
|     throw new Error( | ||||
|       `Signing using signWin.js script: failed: TARGET PATH NOT FOUND` | ||||
|     ) | ||||
|   } | ||||
|  | ||||
|   try { | ||||
|     execSync( | ||||
|       `smctl sign --fingerprint="${ | ||||
|         process.env.WINDOWS_CERTIFICATE_THUMBPRINT | ||||
|       }" --input "${String(configuration.path)}"`, | ||||
|       { | ||||
|         stdio: 'inherit', | ||||
|       } | ||||
|     ) | ||||
|     console.log('Signing using signWin.js script: successful') | ||||
|   } catch (error) { | ||||
|     console.error('Signing using signWin.js script: failed:', error) | ||||
|   } | ||||
| } | ||||
							
								
								
									
										35
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								src/main.ts
									
									
									
									
									
								
							| @ -8,6 +8,7 @@ import { Issuer } from 'openid-client' | ||||
| import { Bonjour, Service } from 'bonjour-service' | ||||
| // @ts-ignore: TS1343 | ||||
| import * as kittycad from '@kittycad/lib/import' | ||||
| import electronUpdater, { type AppUpdater } from 'electron-updater' | ||||
| import minimist from 'minimist' | ||||
| import getCurrentProjectFile from 'lib/getCurrentProjectFile' | ||||
|  | ||||
| @ -59,8 +60,8 @@ const createWindow = (): BrowserWindow => { | ||||
|       preload: path.join(__dirname, './preload.js'), | ||||
|     }, | ||||
|     icon: path.resolve(process.cwd(), 'assets', 'icon.png'), | ||||
|     frame: false, | ||||
|     titleBarStyle: 'hiddenInset', | ||||
|     // frame: false, | ||||
|     // titleBarStyle: 'hiddenInset', | ||||
|   }) | ||||
|  | ||||
|   // and load the index.html of the app. | ||||
| @ -191,6 +192,36 @@ ipcMain.handle('find_machine_api', () => { | ||||
|   }) | ||||
| }) | ||||
|  | ||||
| export function getAutoUpdater(): AppUpdater { | ||||
|   // Using destructuring to access autoUpdater due to the CommonJS module of 'electron-updater'. | ||||
|   // It is a workaround for ESM compatibility issues, see https://github.com/electron-userland/electron-builder/issues/7976. | ||||
|   const { autoUpdater } = electronUpdater | ||||
|   return autoUpdater | ||||
| } | ||||
|  | ||||
| export async function checkForUpdates(autoUpdater: AppUpdater) { | ||||
|   // TODO: figure out how to get the update modal back | ||||
|   const result = await autoUpdater.checkForUpdatesAndNotify() | ||||
|   console.log(result) | ||||
| } | ||||
|  | ||||
| app.on('ready', async () => { | ||||
|   const autoUpdater = getAutoUpdater() | ||||
|   checkForUpdates(autoUpdater) | ||||
|   const fifteenMinutes = 15 * 60 * 1000 | ||||
|   setInterval(() => { | ||||
|     checkForUpdates(autoUpdater) | ||||
|   }, fifteenMinutes) | ||||
|  | ||||
|   autoUpdater.on('update-available', (info) => { | ||||
|     console.log('update-available', info) | ||||
|   }) | ||||
|  | ||||
|   autoUpdater.on('update-downloaded', (info) => { | ||||
|     console.log('update-downloaded', info) | ||||
|   }) | ||||
| }) | ||||
|  | ||||
| ipcMain.handle('loadProjectAtStartup', async () => { | ||||
|   // If we are in development mode, we don't want to load a project at | ||||
|   // startup. | ||||
|  | ||||
| @ -49,7 +49,13 @@ export function getDefineKeys(names: string[]) { | ||||
|  | ||||
| export function getBuildDefine(env: ConfigEnv<'build'>) { | ||||
|   const { command, forgeConfig } = env | ||||
|   const names = forgeConfig.renderer | ||||
|   const renderer = [ | ||||
|     { | ||||
|       name: 'main_window', | ||||
|       config: 'vite.renderer.config.ts', | ||||
|     }, | ||||
|   ] | ||||
|   const names = renderer | ||||
|     .filter(({ name }) => name != null) | ||||
|     .map(({ name }) => name!) | ||||
|   const defineKeys = getDefineKeys(names) | ||||
|  | ||||
| @ -67,7 +67,7 @@ export default defineConfig((env) => { | ||||
|     }, | ||||
|     build: { | ||||
|       lib: { | ||||
|         entry: forgeConfigSelf.entry!, | ||||
|         entry: 'src/main.ts', | ||||
|         fileName: () => '[name].js', | ||||
|         formats: ['cjs'], | ||||
|       }, | ||||
|  | ||||
| @ -20,7 +20,7 @@ export default defineConfig((env) => { | ||||
|     base: './', | ||||
|     build: { | ||||
|       lib: { | ||||
|         entry: forgeConfigSelf.entry!, | ||||
|         entry: 'src/preload.ts', | ||||
|         fileName: () => '[name].js', | ||||
|         formats: ['cjs'], | ||||
|       }, | ||||
|  | ||||
| @ -9,7 +9,7 @@ import { lezer } from '@lezer/generator/rollup' | ||||
| export default defineConfig((env) => { | ||||
|   const forgeEnv = env as ConfigEnv<'renderer'> | ||||
|   const { root, mode, forgeConfigSelf } = forgeEnv | ||||
|   const name = forgeConfigSelf.name ?? '' | ||||
|   const name = 'main_window' | ||||
|  | ||||
|   return { | ||||
|     root, | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	