Publish static beta redirect artifacts#5603
Conversation
Greptile SummaryThis PR adds a new CI step to the macOS desktop release workflow that publishes three static redirect artifacts ( Key issues found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant CM as Codemagic CI
participant GH as GitHub Releases
participant GCS as GCS Bucket (omi_macos_updates)
participant Browser as End-User Browser
CM->>GH: gh release create $CM_TAG (uploads omi.dmg + Omi.zip)
CM->>CM: Generate index.html / redirect.json / latest-url.txt in /tmp
CM->>GCS: gcloud storage cp → beta/index.html (no-store)
CM->>GCS: gcloud storage cp → beta/redirect.json (no-store)
CM->>GCS: gcloud storage cp → beta/latest-url.txt (no-store)
Note over CM,GCS: ⚠️ Step aborts before any cp if bash<4.4 (@Q bad substitution)
Browser->>GCS: GET macos.omi.me/beta (after infra cutover)
GCS-->>Browser: 200 index.html (meta-refresh + JS redirect)
Browser->>GH: Download omi.dmg from GitHub release asset URL
Last reviewed commit: b47bf11 |
| gcloud storage cp \ | ||
| --cache-control="no-store,max-age=0" \ | ||
| /tmp/macos-beta-index.html \ | ||
| "$GCS_DESKTOP_UPDATES_BUCKET/beta/index.html" |
There was a problem hiding this comment.
Specify explicit --content-type for the HTML artifact
gcloud storage cp infers MIME type from the file extension by default, so index.html should get text/html. However, it won't automatically append ; charset=utf-8, which can cause browsers to fall back to a legacy encoding and potentially mishandle the Unicode ellipsis (…) in the <title>. Explicitly declaring the content-type is more robust:
| gcloud storage cp \ | |
| --cache-control="no-store,max-age=0" \ | |
| /tmp/macos-beta-index.html \ | |
| "$GCS_DESKTOP_UPDATES_BUCKET/beta/index.html" | |
| gcloud storage cp \ | |
| --cache-control="no-store,max-age=0" \ | |
| --content-type="text/html; charset=utf-8" \ | |
| /tmp/macos-beta-index.html \ | |
| "$GCS_DESKTOP_UPDATES_BUCKET/beta/index.html" |
| <body> | ||
| <p>Redirecting to the latest Omi Beta download.</p> | ||
| <p><a href="${BETA_DMG_URL}">If you are not redirected, click here.</a></p> | ||
| <script>window.location.replace(${BETA_DMG_URL@Q});</script> |
There was a problem hiding this comment.
@Q requires bash ≥ 4.4 — aborts on macOS system bash 3.2
The ${BETA_DMG_URL@Q} parameter transformation (@Q = shell-quote the value) was introduced in bash 4.4. macOS ships /bin/bash at version 3.2.57, which is the interpreter Codemagic macOS agents default to when running script: blocks. When bash 3.2 evaluates this heredoc and encounters @Q, it emits bad substitution and exits immediately. Because set -e is active at the top of the script, the entire step aborts — no index.html, redirect.json, or latest-url.txt is ever uploaded to GCS.
The quoting is also unnecessary: $BETA_DMG_URL is always a well-formed GitHub release asset URL containing no shell-special or JavaScript-special characters, so it is safe to embed directly. Drop the @Q transform:
| <script>window.location.replace(${BETA_DMG_URL@Q});</script> | |
| <script>window.location.replace("${BETA_DMG_URL}");</script> |
Summary
Notes