From dd4d0f6d98784050f09780aff62cb8cc670b6eae Mon Sep 17 00:00:00 2001 From: Pierre Jacquier Date: Mon, 9 Jun 2025 15:43:48 -0400 Subject: [PATCH] Rename nightly to staging and have it point to dev infra (#7422) * Rename nightly to staging and have it point to dev infra Fixes #7421 * To revert: force IS_STAGING * chmod +x ./scripts/flip-files-to-staging.sh * Fix mix up dev and prod * Revert "To revert: force IS_STAGING" This reverts commit 0178604a5555d9e98b7c3c5723fa2e18dd660ad4. --- .github/workflows/build-apps.yml | 44 +++++++++--------- assets/{icon-nightly.ico => icon-staging.ico} | Bin assets/{icon-nightly.png => icon-staging.png} | Bin package.json | 6 +-- scripts/flip-files-to-nightly.ps1 | 20 -------- scripts/flip-files-to-nightly.sh | 20 -------- scripts/flip-files-to-staging.ps1 | 20 ++++++++ scripts/flip-files-to-staging.sh | 20 ++++++++ ...ller-nightly.nsh => installer-staging.nsh} | 8 ++-- scripts/invalidate-files-bucket.sh | 4 +- src/components/ToastUpdate.tsx | 4 +- src/lib/createMachineCommand.ts | 4 +- src/lib/desktop.ts | 8 ++-- src/lib/settings/initialSettings.tsx | 4 +- src/routes/utils.ts | 6 +-- 15 files changed, 84 insertions(+), 84 deletions(-) rename assets/{icon-nightly.ico => icon-staging.ico} (100%) rename assets/{icon-nightly.png => icon-staging.png} (100%) delete mode 100644 scripts/flip-files-to-nightly.ps1 delete mode 100755 scripts/flip-files-to-nightly.sh create mode 100644 scripts/flip-files-to-staging.ps1 create mode 100755 scripts/flip-files-to-staging.sh rename scripts/{installer-nightly.nsh => installer-staging.nsh} (59%) diff --git a/.github/workflows/build-apps.yml b/.github/workflows/build-apps.yml index f44cf646d..fba3eeb23 100644 --- a/.github/workflows/build-apps.yml +++ b/.github/workflows/build-apps.yml @@ -10,7 +10,7 @@ on: env: IS_RELEASE: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }} - IS_NIGHTLY: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + IS_STAGING: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -91,14 +91,14 @@ jobs: if: ${{ steps.wasm.outputs.should-build-wasm == 'true' }} run: "npm run build:wasm" - - name: Set nightly version, product name, release notes, and icons - if: ${{ env.IS_NIGHTLY == 'true' }} + - name: Set staging version, product name, release notes, and icons + if: ${{ env.IS_STAGING == 'true' }} run: | COMMIT=$(git rev-parse --short HEAD) DATE=$(date +'%-y.%-m.%-d') export VERSION=$DATE-main.$COMMIT npm run files:set-version - npm run files:flip-to-nightly + npm run files:flip-to-staging - name: Set release version if: ${{ env.IS_RELEASE == 'true' }} @@ -167,7 +167,7 @@ jobs: - run: npm install - name: Prepare certificate and variables (Windows only) - if: ${{ (env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true') && matrix.platform == 'win' }} + if: ${{ (env.IS_RELEASE == 'true' || env.IS_STAGING == 'true') && matrix.platform == 'win' }} run: | echo "${{secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /c/Certificate_pkcs12.p12 cat /c/Certificate_pkcs12.p12 @@ -182,7 +182,7 @@ jobs: shell: bash - name: Setup certicate with SSM KSP (Windows only) - if: ${{ (env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true') && matrix.platform == 'win' }} + if: ${{ (env.IS_RELEASE == 'true' || env.IS_STAGING == 'true') && matrix.platform == 'win' }} 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 @@ -192,7 +192,7 @@ jobs: smksp_cert_sync.exe smctl windows certsync # This last line `smctl windows certsync` was added after windows codesign failures started happening - # with nightly-v25.4.10. It looks like `smksp_cert_sync.exe` used to do the sync to the local cert store, + # with staging-v25.4.10. It looks like `smksp_cert_sync.exe` used to do the sync to the local cert store, # but stopped doing it overnight. This extra call that I randomly got from this azure-related doc page # https://docs.digicert.com/en/digicert-keylocker/code-signing/sign-with-third-party-signing-tools/windows-applications/sign-azure-apps-with-signtool-using-ksp-library.html#sync-certificates--windows-only--618365 # seems to be doing that extra sync that we need for scripts/sign-win.js to work. @@ -200,13 +200,13 @@ jobs: shell: cmd - name: Build the app (debug) - if: ${{ env.IS_RELEASE == 'false' && env.IS_NIGHTLY == 'false' }} + if: ${{ env.IS_RELEASE == 'false' && env.IS_STAGING == 'false' }} # electron-builder doesn't have a concept of release vs debug, # this is just not doing any codesign or release yml generation, and points to dev infra run: npm run tronb:package:dev - name: Build the app (release) - if: ${{ env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true' }} + if: ${{ env.IS_RELEASE == 'true' || env.IS_STAGING == 'true' }} env: APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} @@ -216,7 +216,7 @@ jobs: CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} CSC_KEYCHAIN: ${{ secrets.APPLE_SIGNING_IDENTITY }} WINDOWS_CERTIFICATE_THUMBPRINT: ${{ secrets.WINDOWS_CERTIFICATE_THUMBPRINT }} - run: npm run tronb:package:prod + run: npm run tronb:package:${{ env.IS_STAGING == 'true' && 'dev' || 'prod' }} - name: List artifacts in out/ run: ls -R out @@ -240,20 +240,20 @@ jobs: out/*-x86_64-linux.* - uses: actions/upload-artifact@v4 - if: ${{ env.IS_RELEASE == 'true' || env.IS_NIGHTLY == 'true' }} + if: ${{ env.IS_RELEASE == 'true' || env.IS_STAGING == 'true' }} with: name: out-yml-${{ matrix.platform }} path: | out/latest*.yml - # TODO: add the 'Build for Mac TestFlight (nightly)' stage back + # TODO: add the 'Build for Mac TestFlight' stage back upload-apps-release: runs-on: ubuntu-22.04 permissions: contents: write - # Equivalent to IS_RELEASE || IS_NIGHTLY (but we can't access those env vars here) + # Equivalent to IS_RELEASE || IS_STAGING (but we can't access those env vars here) if: ${{ (github.ref_type == 'tag' && startsWith(github.ref_name, 'v')) || (github.event_name == 'push' && github.ref == 'refs/heads/main') }} env: VERSION_NO_V: ${{ needs.prepare-files.outputs.version }} @@ -311,8 +311,8 @@ jobs: env: NOTES: ${{ needs.prepare-files.outputs.notes }} PUB_DATE: ${{ github.event.repository.updated_at }} - WEBSITE_DIR: ${{ env.IS_NIGHTLY == 'true' && 'dl.zoo.dev/releases/modeling-app/nightly' || 'dl.zoo.dev/releases/modeling-app' }} - URL_CODED_NAME: ${{ env.IS_NIGHTLY == 'true' && 'Zoo%20Design%20Studio%20%28Nightly%29' || 'Zoo%20Design%20Studio' }} + WEBSITE_DIR: ${{ env.IS_STAGING == 'true' && 'dl.zoo.dev/releases/modeling-app/staging' || 'dl.zoo.dev/releases/modeling-app' }} + URL_CODED_NAME: ${{ env.IS_STAGING == 'true' && 'Zoo%20Design%20Studio%20%28Staging%29' || 'Zoo%20Design%20Studio' }} run: | RELEASE_DIR=https://${WEBSITE_DIR} jq --null-input \ @@ -361,26 +361,26 @@ jobs: run: "ls -R out" - name: Authenticate to Google Cloud - if: ${{ env.IS_NIGHTLY == 'true' }} + if: ${{ env.IS_STAGING == 'true' }} uses: 'google-github-actions/auth@v2.1.8' with: credentials_json: '${{ secrets.GOOGLE_CLOUD_DL_SA }}' - name: Set up Google Cloud SDK - if: ${{ env.IS_NIGHTLY == 'true' }} + if: ${{ env.IS_STAGING == 'true' }} uses: google-github-actions/setup-gcloud@v2.1.4 with: project_id: ${{ env.GOOGLE_CLOUD_PROJECT_ID }} - - name: Upload nightly files to public bucket - if: ${{ env.IS_NIGHTLY == 'true' }} + - name: Upload staging files to public bucket + if: ${{ env.IS_STAGING == 'true' }} uses: google-github-actions/upload-cloud-storage@v2.2.2 with: path: out glob: '*' parent: false - destination: 'dl.kittycad.io/releases/modeling-app/nightly' + destination: 'dl.kittycad.io/releases/modeling-app/staging' - name: Invalidate bucket cache on latest*.yml and last_download.json files - if: ${{ env.IS_NIGHTLY == 'true' }} - run: npm run files:invalidate-bucket:nightly + if: ${{ env.IS_STAGING == 'true' }} + run: npm run files:invalidate-bucket:staging diff --git a/assets/icon-nightly.ico b/assets/icon-staging.ico similarity index 100% rename from assets/icon-nightly.ico rename to assets/icon-staging.ico diff --git a/assets/icon-nightly.png b/assets/icon-staging.png similarity index 100% rename from assets/icon-nightly.png rename to assets/icon-staging.png diff --git a/package.json b/package.json index 72bcdcfde..5d56502a2 100644 --- a/package.json +++ b/package.json @@ -116,10 +116,10 @@ "circular-deps:diff:nodejs": "npm run circular-deps:diff || node ./scripts/diff.js", "files:set-version": "echo \"$(jq --arg v \"$VERSION\" '.version=$v' package.json --indent 2)\" > package.json", "files:set-notes": "./scripts/set-files-notes.sh", - "files:flip-to-nightly": "./scripts/flip-files-to-nightly.sh", - "files:flip-to-nightly:windows": "powershell -ExecutionPolicy Bypass -File ./scripts/flip-files-to-nightly.ps1", + "files:flip-to-staging": "./scripts/flip-files-to-staging.sh", + "files:flip-to-staging:windows": "powershell -ExecutionPolicy Bypass -File ./scripts/flip-files-to-staging.ps1", "files:invalidate-bucket": "./scripts/invalidate-files-bucket.sh", - "files:invalidate-bucket:nightly": "./scripts/invalidate-files-bucket.sh --nightly", + "files:invalidate-bucket:staging": "./scripts/invalidate-files-bucket.sh --staging", "postinstall": "electron-rebuild", "generate:machine-api": "npx openapi-typescript ./openapi/machine-api.json -o src/lib/machine-api.d.ts", "tron:start": "electron-forge start", diff --git a/scripts/flip-files-to-nightly.ps1 b/scripts/flip-files-to-nightly.ps1 deleted file mode 100644 index 08199d22a..000000000 --- a/scripts/flip-files-to-nightly.ps1 +++ /dev/null @@ -1,20 +0,0 @@ -$VERSION=$(Get-Date -Format "yy.M.d") -$COMMIT=$(git rev-parse --short HEAD) -$PRODUCT_NAME="Zoo Design Studio (Nightly)" - -# package.json -yq -i '.version = env(VERSION)' -p=json -o=json package.json -yq -i '.productName = env(PRODUCT_NAME)' -p=json -o=json package.json -yq -i '.name = "zoo-modeling-app-nightly"' -p=json -o=json package.json - -# electron-builder.yml -yq -i '.publish[0].url = "https://dl.zoo.dev/releases/modeling-app/nightly"' electron-builder.yml -yq -i '.appId = "dev.zoo.modeling-app-nightly"' electron-builder.yml -yq -i '.nsis.include = "./scripts/installer-nightly.nsh"' electron-builder.yml - -# Release notes -echo "Nightly build $VERSION (commit $COMMIT)" > release-notes.md - -# icons -cp assets/icon-nightly.png assets/icon.png -cp assets/icon-nightly.ico assets/icon.ico diff --git a/scripts/flip-files-to-nightly.sh b/scripts/flip-files-to-nightly.sh deleted file mode 100755 index 5c8c85c13..000000000 --- a/scripts/flip-files-to-nightly.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -COMMIT=$(git rev-parse --short HEAD) -TITLE=$(git show -s --format=%s $COMMIT) - -# package.json -PACKAGE=$(jq '.productName="Zoo Design Studio (Nightly)" | .name="zoo-modeling-app-nightly"' package.json --indent 2) -echo "$PACKAGE" > package.json - -# electron-builder.yml -yq -i '.publish[0].url = "https://dl.zoo.dev/releases/modeling-app/nightly"' electron-builder.yml -yq -i '.appId = "dev.zoo.modeling-app-nightly"' electron-builder.yml -yq -i '.nsis.include = "./scripts/installer-nightly.nsh"' electron-builder.yml - -# Release notes -echo "[$TITLE](https://github.com/KittyCAD/modeling-app/commit/$COMMIT)" > release-notes.md - -# icons -cp assets/icon-nightly.png assets/icon.png -cp assets/icon-nightly.ico assets/icon.ico diff --git a/scripts/flip-files-to-staging.ps1 b/scripts/flip-files-to-staging.ps1 new file mode 100644 index 000000000..e77c1f16e --- /dev/null +++ b/scripts/flip-files-to-staging.ps1 @@ -0,0 +1,20 @@ +$VERSION=$(Get-Date -Format "yy.M.d") +$COMMIT=$(git rev-parse --short HEAD) +$PRODUCT_NAME="Zoo Design Studio (Staging)" + +# package.json +yq -i '.version = env(VERSION)' -p=json -o=json package.json +yq -i '.productName = env(PRODUCT_NAME)' -p=json -o=json package.json +yq -i '.name = "zoo-modeling-app-staging"' -p=json -o=json package.json + +# electron-builder.yml +yq -i '.publish[0].url = "https://dl.zoo.dev/releases/modeling-app/staging"' electron-builder.yml +yq -i '.appId = "dev.zoo.modeling-app-staging"' electron-builder.yml +yq -i '.nsis.include = "./scripts/installer-staging.nsh"' electron-builder.yml + +# Release notes +echo "Staging build $VERSION (commit $COMMIT)" > release-notes.md + +# icons +cp assets/icon-staging.png assets/icon.png +cp assets/icon-staging.ico assets/icon.ico diff --git a/scripts/flip-files-to-staging.sh b/scripts/flip-files-to-staging.sh new file mode 100755 index 000000000..97eb256a6 --- /dev/null +++ b/scripts/flip-files-to-staging.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +COMMIT=$(git rev-parse --short HEAD) +TITLE=$(git show -s --format=%s $COMMIT) + +# package.json +PACKAGE=$(jq '.productName="Zoo Design Studio (Staging)" | .name="zoo-modeling-app-staging"' package.json --indent 2) +echo "$PACKAGE" > package.json + +# electron-builder.yml +yq -i '.publish[0].url = "https://dl.zoo.dev/releases/modeling-app/staging"' electron-builder.yml +yq -i '.appId = "dev.zoo.modeling-app-staging"' electron-builder.yml +yq -i '.nsis.include = "./scripts/installer-staging.nsh"' electron-builder.yml + +# Release notes +echo "[$TITLE](https://github.com/KittyCAD/modeling-app/commit/$COMMIT)" > release-notes.md + +# icons +cp assets/icon-staging.png assets/icon.png +cp assets/icon-staging.ico assets/icon.ico diff --git a/scripts/installer-nightly.nsh b/scripts/installer-staging.nsh similarity index 59% rename from scripts/installer-nightly.nsh rename to scripts/installer-staging.nsh index 9f8ebd528..1787e87b8 100644 --- a/scripts/installer-nightly.nsh +++ b/scripts/installer-staging.nsh @@ -1,8 +1,8 @@ !macro preInit SetRegView 64 - WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\Zoo Design Studio (Nightly)" - WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\Zoo Design Studio (Nightly)" + WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\Zoo Design Studio (Staging)" + WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\Zoo Design Studio (Staging)" SetRegView 32 - WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\Zoo Design Studio (Nightly)" - WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\Zoo Design Studio (Nightly)" + WriteRegExpandStr HKLM "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\Zoo Design Studio (Staging)" + WriteRegExpandStr HKCU "${INSTALL_REGISTRY_KEY}" InstallLocation "C:\Program Files\Zoo Design Studio (Staging)" !macroend \ No newline at end of file diff --git a/scripts/invalidate-files-bucket.sh b/scripts/invalidate-files-bucket.sh index 1be90b8e8..ac11f8ac5 100755 --- a/scripts/invalidate-files-bucket.sh +++ b/scripts/invalidate-files-bucket.sh @@ -1,7 +1,7 @@ #!/bin/bash base_dir="/releases/modeling-app" -if [[ $1 = "--nightly" ]]; then - base_dir="/releases/modeling-app/nightly" +if [[ $1 = "--staging" ]]; then + base_dir="/releases/modeling-app/staging" fi echo "Invalidating json and yml files at $base_dir in the download bucket" diff --git a/src/components/ToastUpdate.tsx b/src/components/ToastUpdate.tsx index 1660d0b52..c973adaae 100644 --- a/src/components/ToastUpdate.tsx +++ b/src/components/ToastUpdate.tsx @@ -5,7 +5,7 @@ import toast from 'react-hot-toast' import { ActionButton } from '@src/components/ActionButton' import { SafeRenderer } from '@src/lib/markdown' import { openExternalBrowserIfDesktop } from '@src/lib/openWindow' -import { getReleaseUrl, IS_NIGHTLY_OR_DEBUG } from '@src/routes/utils' +import { getReleaseUrl, IS_STAGING_OR_DEBUG } from '@src/routes/utils' export function ToastUpdate({ version, @@ -42,7 +42,7 @@ export function ToastUpdate({

A new update is available. - {!IS_NIGHTLY_OR_DEBUG && ( + {!IS_STAGING_OR_DEBUG && ( {' '} You can view the release notes{' '} diff --git a/src/lib/createMachineCommand.ts b/src/lib/createMachineCommand.ts index 7212277cd..3638b6002 100644 --- a/src/lib/createMachineCommand.ts +++ b/src/lib/createMachineCommand.ts @@ -16,7 +16,7 @@ import type { StateMachineCommandSetSchema, } from '@src/lib/commandTypes' import { isDesktop } from '@src/lib/isDesktop' -import { IS_NIGHTLY_OR_DEBUG } from '@src/routes/utils' +import { IS_STAGING_OR_DEBUG } from '@src/routes/utils' interface CreateMachineCommandProps< T extends AnyStateMachine, @@ -89,7 +89,7 @@ export function createMachineCommand< } else if ('status' in commandConfig) { const { status } = commandConfig if (status === 'inactive') return null - if (status === 'development' && !(DEV || IS_NIGHTLY_OR_DEBUG)) return null + if (status === 'development' && !(DEV || IS_STAGING_OR_DEBUG)) return null } const icon = ('icon' in commandConfig && commandConfig.icon) || undefined diff --git a/src/lib/desktop.ts b/src/lib/desktop.ts index ef68975d0..5899710bc 100644 --- a/src/lib/desktop.ts +++ b/src/lib/desktop.ts @@ -25,7 +25,7 @@ import type { FileEntry, FileMetadata, Project } from '@src/lib/project' import { err } from '@src/lib/trap' import type { DeepPartial } from '@src/lib/types' import { getInVariableCase } from '@src/lib/utils' -import { IS_NIGHTLY } from '@src/routes/utils' +import { IS_STAGING } from '@src/routes/utils' export async function renameProjectDirectory( projectPath: string, @@ -461,8 +461,8 @@ export async function writeProjectSettingsFile( // Important for saving settings. // TODO: should be pulled from electron-builder.yml -const APP_ID = IS_NIGHTLY - ? 'dev.zoo.modeling-app-nightly' +const APP_ID = IS_STAGING + ? 'dev.zoo.modeling-app-staging' : 'dev.zoo.modeling-app' const getAppFolderName = () => { @@ -470,7 +470,7 @@ const getAppFolderName = () => { return APP_ID } // TODO: we need to make linux use the same convention this is weird - // This variable below gets the -nightly suffix on nightly too thru scripts/flip-files-to-nightly.sh + // This variable below gets the -staging suffix on staging too thru scripts/flip-files-to-staging.sh // But it should be consistent with the reserve domain app id we use on Windows and Linux return window.electron.packageJson.name } diff --git a/src/lib/settings/initialSettings.tsx b/src/lib/settings/initialSettings.tsx index 4b530977b..0c2135d6e 100644 --- a/src/lib/settings/initialSettings.tsx +++ b/src/lib/settings/initialSettings.tsx @@ -24,7 +24,7 @@ import { Themes } from '@src/lib/theme' import { reportRejection } from '@src/lib/trap' import { isEnumMember } from '@src/lib/types' import { capitaliseFC, isArray, toSync } from '@src/lib/utils' -import { IS_NIGHTLY_OR_DEBUG } from '@src/routes/utils' +import { IS_STAGING_OR_DEBUG } from '@src/routes/utils' /** * A setting that can be set at the user or project level @@ -212,7 +212,7 @@ export function createSettings() { * Stream resource saving behavior toggle */ streamIdleMode: new Setting({ - defaultValue: IS_NIGHTLY_OR_DEBUG ? 30 * 1000 : 5 * MS_IN_MINUTE, + defaultValue: IS_STAGING_OR_DEBUG ? 30 * 1000 : 5 * MS_IN_MINUTE, hideOnLevel: 'project', hideOnPlatform: 'both', description: 'Save bandwidth & battery', diff --git a/src/routes/utils.ts b/src/routes/utils.ts index 4a0ab2e19..51f04f007 100644 --- a/src/routes/utils.ts +++ b/src/routes/utils.ts @@ -17,12 +17,12 @@ export const PACKAGE_NAME = isDesktop() ? window.electron.packageJson.name : 'zoo-modeling-app' -export const IS_NIGHTLY = PACKAGE_NAME.indexOf('-nightly') > -1 +export const IS_STAGING = PACKAGE_NAME.indexOf('-staging') > -1 -export const IS_NIGHTLY_OR_DEBUG = IS_NIGHTLY || APP_VERSION === '0.0.0' +export const IS_STAGING_OR_DEBUG = IS_STAGING || APP_VERSION === '0.0.0' export function getReleaseUrl(version: string = APP_VERSION) { - if (IS_NIGHTLY_OR_DEBUG || version === 'main') { + if (IS_STAGING_OR_DEBUG || version === 'main') { return 'https://github.com/KittyCAD/modeling-app/commits/main' }