|
54 | 54 | - name: Checkout code |
55 | 55 | uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 |
56 | 56 |
|
| 57 | + # Prerelease versions carry their environment in the tag: -dev.N is a |
| 58 | + # dev build, -staging.N a staging build. Legacy -alpha/-beta tags remain |
| 59 | + # accepted while already-published builds age out. The channel decides the app's |
| 60 | + # identity (name/bundle id — a separate app per environment, installable |
| 61 | + # side by side) and the default origin baked into the bundle, which in |
| 62 | + # turn selects the update feed the installed app polls. |
| 63 | + - name: Resolve channel identity |
| 64 | + id: channel |
| 65 | + env: |
| 66 | + VERSION: ${{ inputs.version }} |
| 67 | + run: | |
| 68 | + case "$VERSION" in |
| 69 | + *-dev.*|*-alpha.*) |
| 70 | + NAME='Sim Dev'; APP_ID=ai.sim.desktop.dev; ORIGIN=https://www.dev.sim.ai; RELEASE_REPOSITORY=simstudioai/sim-desktop-releases; TOKEN_KIND=prerelease ;; |
| 71 | + *-staging.*|*-beta.*) |
| 72 | + NAME='Sim Staging'; APP_ID=ai.sim.desktop.staging; ORIGIN=https://www.staging.sim.ai; RELEASE_REPOSITORY=simstudioai/sim-desktop-releases; TOKEN_KIND=prerelease ;; |
| 73 | + *) |
| 74 | + NAME='Sim'; APP_ID=ai.sim.desktop; ORIGIN=''; RELEASE_REPOSITORY="$GITHUB_REPOSITORY"; TOKEN_KIND=stable ;; |
| 75 | + esac |
| 76 | + { |
| 77 | + echo "name=$NAME" |
| 78 | + echo "app_id=$APP_ID" |
| 79 | + echo "origin=$ORIGIN" |
| 80 | + echo "release_repository=$RELEASE_REPOSITORY" |
| 81 | + echo "token_kind=$TOKEN_KIND" |
| 82 | + } >> "$GITHUB_OUTPUT" |
| 83 | + echo "Building $NAME ($APP_ID) for $RELEASE_REPOSITORY; default origin: ${ORIGIN:-production}" |
| 84 | +
|
| 85 | + - name: Validate release authentication |
| 86 | + if: ${{ inputs.publish }} |
| 87 | + env: |
| 88 | + DESKTOP_RELEASE_TOKEN: ${{ secrets.DESKTOP_RELEASE_TOKEN }} |
| 89 | + RELEASE_REPOSITORY: ${{ steps.channel.outputs.release_repository }} |
| 90 | + TOKEN_KIND: ${{ steps.channel.outputs.token_kind }} |
| 91 | + run: | |
| 92 | + if [ "$TOKEN_KIND" = prerelease ] && [ -z "$DESKTOP_RELEASE_TOKEN" ]; then |
| 93 | + echo "::error::DESKTOP_RELEASE_TOKEN is required to publish prereleases to $RELEASE_REPOSITORY." |
| 94 | + exit 1 |
| 95 | + fi |
| 96 | +
|
57 | 97 | - name: Setup Bun |
58 | 98 | uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2 |
59 | 99 | with: |
@@ -91,34 +131,6 @@ jobs: |
91 | 131 | exit 1 |
92 | 132 | fi |
93 | 133 |
|
94 | | - # Prerelease versions carry their environment in the tag: -dev.N is a |
95 | | - # dev build, -staging.N a staging build. Legacy -alpha/-beta tags remain |
96 | | - # accepted while already-published builds age out. The channel decides the app's |
97 | | - # identity (name/bundle id — a separate app per environment, installable |
98 | | - # side by side) and the default origin baked into the bundle, which in |
99 | | - # turn selects the update feed the installed app polls. |
100 | | - - name: Resolve channel identity |
101 | | - id: channel |
102 | | - env: |
103 | | - VERSION: ${{ inputs.version }} |
104 | | - run: | |
105 | | - case "$VERSION" in |
106 | | - *-dev.*|*-alpha.*) |
107 | | - NAME='Sim Dev'; APP_ID=ai.sim.desktop.dev; ORIGIN=https://www.dev.sim.ai; RELEASE_REPOSITORY=simstudioai/sim-desktop-releases; TOKEN_KIND=prerelease ;; |
108 | | - *-staging.*|*-beta.*) |
109 | | - NAME='Sim Staging'; APP_ID=ai.sim.desktop.staging; ORIGIN=https://www.staging.sim.ai; RELEASE_REPOSITORY=simstudioai/sim-desktop-releases; TOKEN_KIND=prerelease ;; |
110 | | - *) |
111 | | - NAME='Sim'; APP_ID=ai.sim.desktop; ORIGIN=''; RELEASE_REPOSITORY="$GITHUB_REPOSITORY"; TOKEN_KIND=stable ;; |
112 | | - esac |
113 | | - { |
114 | | - echo "name=$NAME" |
115 | | - echo "app_id=$APP_ID" |
116 | | - echo "origin=$ORIGIN" |
117 | | - echo "release_repository=$RELEASE_REPOSITORY" |
118 | | - echo "token_kind=$TOKEN_KIND" |
119 | | - } >> "$GITHUB_OUTPUT" |
120 | | - echo "Building $NAME ($APP_ID) for $RELEASE_REPOSITORY; default origin: ${ORIGIN:-production}" |
121 | | -
|
122 | 134 | - name: Bundle main and preload |
123 | 135 | working-directory: apps/desktop |
124 | 136 | env: |
@@ -179,14 +191,24 @@ jobs: |
179 | 191 | - name: Upload artifacts to the release |
180 | 192 | if: ${{ inputs.publish }} |
181 | 193 | env: |
182 | | - GH_TOKEN: ${{ steps.channel.outputs.token_kind == 'prerelease' && secrets.DESKTOP_RELEASE_TOKEN || github.token }} |
| 194 | + DESKTOP_RELEASE_TOKEN: ${{ secrets.DESKTOP_RELEASE_TOKEN }} |
183 | 195 | RELEASE_REPOSITORY: ${{ steps.channel.outputs.release_repository }} |
| 196 | + SOURCE_RELEASE_TOKEN: ${{ github.token }} |
| 197 | + TOKEN_KIND: ${{ steps.channel.outputs.token_kind }} |
184 | 198 | VERSION: ${{ inputs.version }} |
185 | 199 | run: | |
| 200 | + case "$TOKEN_KIND" in |
| 201 | + prerelease) GH_TOKEN="$DESKTOP_RELEASE_TOKEN" ;; |
| 202 | + stable) GH_TOKEN="$SOURCE_RELEASE_TOKEN" ;; |
| 203 | + *) |
| 204 | + echo "::error::Unknown desktop release token kind: $TOKEN_KIND" |
| 205 | + exit 1 ;; |
| 206 | + esac |
186 | 207 | if [ -z "$GH_TOKEN" ]; then |
187 | | - echo "::error::DESKTOP_RELEASE_TOKEN is required to publish prereleases to $RELEASE_REPOSITORY." |
| 208 | + echo "::error::No GitHub token is available to publish to $RELEASE_REPOSITORY." |
188 | 209 | exit 1 |
189 | 210 | fi |
| 211 | + export GH_TOKEN |
190 | 212 | # electron-builder's GitHub provider always names the manifest |
191 | 213 | # latest-mac.yml (channels are a generic-provider concept), and the |
192 | 214 | # update feed expects exactly that asset name on every release — |
|
0 commit comments