create-disposabl-app 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +36 -8
- package/dist/templates/default/.github/README.md +99 -56
- package/dist/templates/default/.github/actionlint.yaml +6 -0
- package/dist/templates/default/.github/workflows/pipeline.yml.example +492 -0
- package/dist/templates/default/apps/desktop/README.md +44 -14
- package/dist/templates/default/apps/desktop/build-ci.mjs +56 -0
- package/dist/templates/default/apps/desktop/forge.config.mts +36 -17
- package/dist/templates/default/apps/desktop/package.json +5 -5
- package/dist/templates/default/apps/mobile/README.md +127 -0
- package/dist/templates/default/apps/mobile/app.config.js +78 -0
- package/dist/templates/default/apps/mobile/assets/expo.icon/icon.json +21 -26
- package/dist/templates/default/apps/mobile/eas.json +22 -0
- package/dist/templates/default/apps/mobile/eslint.config.js +3 -3
- package/dist/templates/default/apps/mobile/package.json +5 -3
- package/dist/templates/default/apps/mobile/plugins/with-android-signing.js +29 -0
- package/dist/templates/default/apps/mobile/scripts/android-config.test.mjs +128 -0
- package/dist/templates/default/apps/mobile/tsconfig.json +3 -12
- package/dist/templates/default/apps/web/src/index.css +124 -73
- package/dist/templates/default/apps/web/src/routeTree.gen.ts +0 -9
- package/dist/templates/default/bun.lock +121 -11
- package/dist/templates/default/bunfig.toml +8 -1
- package/dist/templates/default/disposabl.json +9 -4
- package/dist/templates/default/gitignore +2 -0
- package/dist/templates/default/package.json +1 -0
- package/dist/templates/default/packages/backend/convex/todos/internal.ts +3 -3
- package/dist/templates/default/packages/backend/package.json +2 -3
- package/dist/templates/default/packages/disposabl-kit/client/styles/globals.css +43 -43
- package/dist/templates/default/packages/disposabl-kit/eslint.config.js +2 -2
- package/dist/templates/default/packages/disposabl-kit/package.json +2 -1
- package/dist/templates/default/packages/disposabl-kit/platforms.ts +87 -0
- package/dist/templates/default/packages/disposabl-kit/server/http.ts +20 -7
- package/dist/templates/default/packages/disposabl-kit/server/lib/functions.ts +1 -10
- package/dist/templates/default/packages/disposabl-kit/server/lib/platform-spec.ts +137 -0
- package/dist/templates/default/turbo.json +16 -5
- package/package.json +1 -1
- package/dist/templates/default/.github/workflows/pipeline.yml +0 -139
- package/dist/templates/default/packages/disposabl-kit/server/dev-setup.mjs +0 -39
- package/dist/templates/default/packages/disposabl-kit/server/lib/mcp-tools.ts +0 -47
- package/dist/templates/default/packages/disposabl-kit/server/lib/platforms.ts +0 -20
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
name: Preview
|
|
2
|
+
on:
|
|
3
|
+
pull_request:
|
|
4
|
+
branches: [main]
|
|
5
|
+
push:
|
|
6
|
+
branches: [main]
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
pull-requests: read
|
|
10
|
+
concurrency:
|
|
11
|
+
group: preview-${{ github.head_ref || github.ref_name }}
|
|
12
|
+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
13
|
+
env:
|
|
14
|
+
CHANNEL: &channel ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.number) || 'production' }}
|
|
15
|
+
DISPOSABL_MOBILE_CHANNEL: *channel
|
|
16
|
+
EAS_ENVIRONMENT: ${{ github.event_name == 'push' && 'production' || 'preview' }}
|
|
17
|
+
EAS_CLI: eas-cli@27.2.0
|
|
18
|
+
BUN_VERSION: &bun-version '1.4.4'
|
|
19
|
+
NODE_VERSION: &node-version '24'
|
|
20
|
+
LINUX_RUNNER: &linux-runner blacksmith-4vcpu-ubuntu-2404
|
|
21
|
+
WEB_RUNNER: &web-runner blacksmith-2vcpu-ubuntu-2404
|
|
22
|
+
WINDOWS_RUNNER: &windows-runner blacksmith-2vcpu-windows-2025
|
|
23
|
+
MACOS_RUNNER: &macos-runner blacksmith-6vcpu-macos-26
|
|
24
|
+
MACOS_BUNDLE_ID: dev.disposabl.starter.desktop
|
|
25
|
+
RELEASE_PREFIX: app
|
|
26
|
+
DISPOSABL_ANDROID_VERSION_CODE: ${{ github.run_number }}
|
|
27
|
+
DISPOSABL_IOS_BUILD_NUMBER: ${{ github.run_number }}
|
|
28
|
+
GH_TOKEN: ${{ github.token }}
|
|
29
|
+
GH_REPO: ${{ github.repository }}
|
|
30
|
+
SOURCE: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
31
|
+
SOURCE_PATH: ${{ github.event_name == 'pull_request' && format('pulls/{0}', github.event.number) || 'git/ref/heads/main' }}
|
|
32
|
+
DISPOSABL_RELEASE_VERSION: 1.0.${{ github.run_number }}
|
|
33
|
+
|
|
34
|
+
jobs:
|
|
35
|
+
web:
|
|
36
|
+
name: Web
|
|
37
|
+
permissions: &release-permissions
|
|
38
|
+
contents: write
|
|
39
|
+
pull-requests: read
|
|
40
|
+
timeout-minutes: 45
|
|
41
|
+
runs-on: *web-runner
|
|
42
|
+
outputs:
|
|
43
|
+
android_build: ${{ steps.fingerprint.outputs.build }}
|
|
44
|
+
android_runtime: ${{ steps.fingerprint.outputs.runtime }}
|
|
45
|
+
android_manifest: ${{ steps.fingerprint.outputs.manifest }}
|
|
46
|
+
ios_build: ${{ steps.ios.outputs.build }}
|
|
47
|
+
ios_manifest: ${{ steps.ios.outputs.manifest }}
|
|
48
|
+
convex_url: ${{ steps.deploy.outputs.CONVEX_URL }}
|
|
49
|
+
convex_site_url: ${{ steps.deploy.outputs.CONVEX_SITE_URL }}
|
|
50
|
+
env:
|
|
51
|
+
PLATFORM: android
|
|
52
|
+
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
|
|
53
|
+
EXPO_PROJECT_ID: ${{ vars.EXPO_PROJECT_ID }}
|
|
54
|
+
EXPO_OWNER: ${{ vars.EXPO_OWNER }}
|
|
55
|
+
EXPO_SLUG: ${{ vars.EXPO_SLUG }}
|
|
56
|
+
EXPO_NO_DOTENV: '1'
|
|
57
|
+
steps:
|
|
58
|
+
- &checkout
|
|
59
|
+
name: Checkout
|
|
60
|
+
uses: actions/checkout@v6
|
|
61
|
+
with: {ref: "${{ env.SOURCE }}", persist-credentials: false}
|
|
62
|
+
- &platforms
|
|
63
|
+
name: Platforms
|
|
64
|
+
shell: bash
|
|
65
|
+
id: platforms
|
|
66
|
+
env:
|
|
67
|
+
BEFORE: ${{ github.event.before }}
|
|
68
|
+
PR: ${{ github.event.number }}
|
|
69
|
+
TRUSTED: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
|
|
70
|
+
run: |
|
|
71
|
+
if [[ "$GITHUB_JOB" == android || "$GITHUB_JOB" == ios ]]; then exit; fi
|
|
72
|
+
if [[ "$TRUSTED" != true ]]; then printf 'android=false\nios=false\ndesktop=[]\nselected=false\n' >> "$GITHUB_OUTPUT"; exit; fi
|
|
73
|
+
if [[ -n "$PR" ]]; then
|
|
74
|
+
gh api "repos/$GH_REPO/pulls/$PR/files?per_page=100" --paginate --jq '.[] | .filename, (.previous_filename // empty)' > "$RUNNER_TEMP/changes"
|
|
75
|
+
elif [[ -z "$BEFORE" || "$BEFORE" =~ ^0+$ ]]; then echo disposabl.json > "$RUNNER_TEMP/changes"
|
|
76
|
+
else
|
|
77
|
+
git -c credential.helper= -c 'credential.helper=!gh auth git-credential' fetch --depth=1 origin "$BEFORE"
|
|
78
|
+
git diff --name-only --no-renames "$BEFORE" "$SOURCE" > "$RUNNER_TEMP/changes"
|
|
79
|
+
fi
|
|
80
|
+
node --input-type=module -e '
|
|
81
|
+
import {readFileSync} from "node:fs";
|
|
82
|
+
import {execFileSync} from "node:child_process";
|
|
83
|
+
const relevant = p => p && !/(^|\/)\.agents\/|\.(md|mdx)$/.test(p);
|
|
84
|
+
const paths = readFileSync(`${process.env.RUNNER_TEMP}/changes`, "utf8").split(/\r?\n/).filter(relevant);
|
|
85
|
+
const enabled = JSON.parse(readFileSync("disposabl.json", "utf8")).platforms;
|
|
86
|
+
const api = path => JSON.parse(execFileSync("gh", ["api", `repos/${process.env.GH_REPO}/${path}`], {encoding: "utf8", stdio: ["ignore", "pipe", "ignore"]}));
|
|
87
|
+
const changes = platform => {
|
|
88
|
+
if (!process.env.PR) return paths;
|
|
89
|
+
try {
|
|
90
|
+
const release = api(`releases/tags/${process.env.RELEASE_PREFIX}-${process.env.CHANNEL}-${platform}`);
|
|
91
|
+
const base = /^Source: ([a-f0-9]{40})$/m.exec(release.body || "")?.[1];
|
|
92
|
+
if (release.draft || !base) return paths;
|
|
93
|
+
if (base === process.env.SOURCE) return [];
|
|
94
|
+
const diff = api(`compare/${base}...${process.env.SOURCE}`);
|
|
95
|
+
// GitHub caps comparison files at 300; never skip on a truncated result.
|
|
96
|
+
return !["ahead", "identical"].includes(diff.status) || !Array.isArray(diff.files) || diff.files.length >= 300 ? ["disposabl.json"] : diff.files.flatMap(f => [f.filename, f.previous_filename]).filter(relevant);
|
|
97
|
+
} catch { return paths; }
|
|
98
|
+
};
|
|
99
|
+
const affected = (platform, directory) => enabled.includes(platform) && changes(platform).some(p => p.startsWith(directory) || /^(bun.lock$|package.json$|disposabl.json$|turbo.json$|bunfig.toml$|patches\/|\.github\/workflows\/pipeline.yml$|packages\/(?!backend\/|create-disposabl-app\/))/.test(p));
|
|
100
|
+
const target = process.env.DISPOSABL_DESKTOP_PLATFORM;
|
|
101
|
+
for (const platform of ["android", "ios"]) console.log(`${platform}=${!target && affected(platform, "apps/mobile/")}`);
|
|
102
|
+
const desktop = ["linux", "windows", "macos"].filter(platform => target === platform && affected(platform, "apps/desktop/"));
|
|
103
|
+
console.log(`desktop=${JSON.stringify(desktop)}\nselected=${desktop.includes(process.env.DISPOSABL_DESKTOP_PLATFORM)}`);
|
|
104
|
+
' >> "$GITHUB_OUTPUT"
|
|
105
|
+
- &node
|
|
106
|
+
name: Node
|
|
107
|
+
if: github.job != 'desktop' || steps.platforms.outputs.selected == 'true'
|
|
108
|
+
uses: actions/setup-node@v6
|
|
109
|
+
with: {node-version: *node-version, package-manager-cache: false}
|
|
110
|
+
- &bun
|
|
111
|
+
name: Bun
|
|
112
|
+
if: github.job != 'desktop' || steps.platforms.outputs.selected == 'true'
|
|
113
|
+
uses: oven-sh/setup-bun@v2
|
|
114
|
+
with: {bun-version: *bun-version}
|
|
115
|
+
- &cache
|
|
116
|
+
name: Cache
|
|
117
|
+
if: github.job != 'desktop' || steps.platforms.outputs.selected == 'true'
|
|
118
|
+
uses: actions/cache@v4
|
|
119
|
+
with:
|
|
120
|
+
path: ~/.bun/install/cache
|
|
121
|
+
key: bun-${{ github.job == 'desktop' && 'desktop-' || '' }}${{ runner.os }}-${{ runner.arch }}-${{ env.BUN_VERSION }}-${{ hashFiles('bun.lock') }}
|
|
122
|
+
restore-keys: bun-${{ github.job == 'desktop' && 'desktop-' || '' }}${{ runner.os }}-${{ runner.arch }}-${{ env.BUN_VERSION }}-
|
|
123
|
+
- &install
|
|
124
|
+
name: Install
|
|
125
|
+
if: github.job != 'desktop' || steps.platforms.outputs.selected == 'true'
|
|
126
|
+
run: bun install --frozen-lockfile ${{ github.job == 'desktop' && '--filter desktop' || (github.job == 'ios' || github.job == 'android') && '--filter @disposabl/mobile' || '' }}
|
|
127
|
+
- name: Check
|
|
128
|
+
run: bun run check
|
|
129
|
+
- name: Deploy
|
|
130
|
+
id: deploy
|
|
131
|
+
env:
|
|
132
|
+
TRUSTED: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
|
|
133
|
+
CONVEX_DEPLOY_KEY: ${{ secrets[github.event_name == 'push' && 'CONVEX_DEPLOY_KEY' || 'CONVEX_DEPLOY_KEY_PREVIEW'] }}
|
|
134
|
+
run: |
|
|
135
|
+
if [[ "$TRUSTED" != true ]]; then VITE_CONVEX_URL=https://ci.invalid VITE_CONVEX_SITE_URL=https://ci.invalid bun run build --filter=@disposabl/web; exit; fi
|
|
136
|
+
: "${CONVEX_DEPLOY_KEY:?Configure the Convex deployment secret for this repository}"
|
|
137
|
+
cd packages/backend
|
|
138
|
+
export AUTH_TARGET=--prod
|
|
139
|
+
target=()
|
|
140
|
+
if [[ "$CHANNEL" != production ]]; then export AUTH_TARGET="--preview-name $CHANNEL"; target=(--preview-name "$CHANNEL"); fi
|
|
141
|
+
bun x --no-install convex deploy --yes "${target[@]}" --cmd-url-env-var-name CONVEX_URL --cmd 'for name in CONVEX_URL CONVEX_SITE_URL; do value=$(printenv "$name"); test -n "$value" || exit 1; for prefix in "" VITE_ EXPO_PUBLIC_; do export "$prefix$name=$value"; printf "%s=%s\n" "$prefix$name" "$value" | tee -a "$GITHUB_ENV" >> "$GITHUB_OUTPUT"; done; done; bun x --no-install --package @convex-dev/auth auth --keys-only $AUTH_TARGET && bun run --cwd ../.. build --filter=@disposabl/web'
|
|
142
|
+
bun x --no-install static-hosting upload $AUTH_TARGET --no-spa --dist ../../apps/web/dist/client
|
|
143
|
+
- &expo
|
|
144
|
+
name: Expo
|
|
145
|
+
if: github.job == 'ios' || github.job == 'android' || steps.platforms.outputs.android == 'true' || steps.platforms.outputs.ios == 'true'
|
|
146
|
+
working-directory: apps/mobile
|
|
147
|
+
run: |
|
|
148
|
+
jq --arg channel "$CHANNEL" '.build["ios-" + env.EAS_ENVIRONMENT].channel = $channel' eas.json > "$RUNNER_TEMP/eas.json"
|
|
149
|
+
mv "$RUNNER_TEMP/eas.json" eas.json
|
|
150
|
+
bun x "$EAS_CLI" env:pull --environment "$EAS_ENVIRONMENT" --path "$RUNNER_TEMP/expo.env" --non-interactive
|
|
151
|
+
bun -e '
|
|
152
|
+
import {parseEnv} from "node:util";
|
|
153
|
+
import {appendFileSync, readFileSync} from "node:fs";
|
|
154
|
+
for (const [key, value] of Object.entries(parseEnv(readFileSync(`${process.env.RUNNER_TEMP}/expo.env`, "utf8")))) {
|
|
155
|
+
// Web and mobile use the same backend from this deployment.
|
|
156
|
+
if (/^CONVEX_(URL|SITE_URL)$/.test(key) && value !== process.env[key]) throw new Error(`EAS overrides the deployed backend: ${key}`);
|
|
157
|
+
if (/^(EXPO_PUBLIC_|VITE_)?CONVEX_(URL|SITE_URL)$/.test(key)) continue;
|
|
158
|
+
if (/^(GITHUB_|RUNNER_|GH_|DISPOSABL_|BUN_|CI$|NODE_OPTIONS$|PATH$|HOME$|SOURCE(_PATH)?$|CHANNEL$|PLATFORM$|RELEASE_PREFIX$|MACOS_|EAS_(ENVIRONMENT|CLI)$|EXPO_(TOKEN|PROJECT_ID|OWNER|SLUG|NO_DOTENV)$)/.test(key)) throw new Error(`Reserved EAS variable: ${key}`);
|
|
159
|
+
const delimiter = crypto.randomUUID();
|
|
160
|
+
appendFileSync(process.env.GITHUB_ENV, `${key}<<${delimiter}\n${value}\n${delimiter}\n`);
|
|
161
|
+
}
|
|
162
|
+
'
|
|
163
|
+
- name: Channel
|
|
164
|
+
if: steps.platforms.outputs.android == 'true' || steps.platforms.outputs.ios == 'true'
|
|
165
|
+
working-directory: apps/mobile
|
|
166
|
+
run: |
|
|
167
|
+
for ((offset=0; ; offset+=25)); do
|
|
168
|
+
bun x "$EAS_CLI" channel:list --json --limit 25 --offset "$offset" > "$RUNNER_TEMP/channels.json"
|
|
169
|
+
if jq -e --arg channel "$CHANNEL" 'any(.currentPage[]; .name == $channel)' "$RUNNER_TEMP/channels.json" > /dev/null; then
|
|
170
|
+
jq -e --arg channel "$CHANNEL" '.currentPage[] | select(.name == $channel) | (.isPaused == false) and (.updateBranches | length == 1) and (.updateBranches[0].name == $channel) and ((.branchMapping | fromjson).data == [{branchId: .updateBranches[0].id, branchMappingLogic: "true"}])' "$RUNNER_TEMP/channels.json" > /dev/null || { echo 'Preview channel must point only to its same-named branch'; exit 1; }
|
|
171
|
+
break
|
|
172
|
+
fi
|
|
173
|
+
if [[ $(jq '.currentPage | length' "$RUNNER_TEMP/channels.json") -lt 25 ]]; then bun x "$EAS_CLI" channel:create "$CHANNEL" --non-interactive; break; fi
|
|
174
|
+
done
|
|
175
|
+
- name: Fingerprint
|
|
176
|
+
id: fingerprint
|
|
177
|
+
if: steps.platforms.outputs.android == 'true'
|
|
178
|
+
working-directory: apps/mobile
|
|
179
|
+
run: |
|
|
180
|
+
for ((page=1; ; page++)); do
|
|
181
|
+
gh api "repos/$GH_REPO/releases?per_page=100&page=$page" > "$RUNNER_TEMP/releases.json"
|
|
182
|
+
jq --arg tag "$RELEASE_PREFIX-$CHANNEL-android" --arg legacy "$RELEASE_PREFIX-$CHANNEL" '[.[] | select(.draft | not) | select(.tag_name == $tag or .tag_name == $legacy or (.tag_name | startswith($legacy + "-"))) | select(any(.assets[]; .name == "android.apk"))] | sort_by(.tag_name != $tag, .tag_name != $legacy) | .[0] // {}' "$RUNNER_TEMP/releases.json" > "$RUNNER_TEMP/release.json"
|
|
183
|
+
if jq -e '.id' "$RUNNER_TEMP/release.json" > /dev/null || [[ $(jq length "$RUNNER_TEMP/releases.json") -lt 100 ]]; then break; fi
|
|
184
|
+
done
|
|
185
|
+
bun x --no-install expo config --json > "$RUNNER_TEMP/mobile.json"
|
|
186
|
+
RUNTIME=$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er 'select(.fingerprintSources != null) | .runtimeVersion | select(test("^[a-f0-9]{40,64}$"))')
|
|
187
|
+
export RUNTIME
|
|
188
|
+
bun -e '
|
|
189
|
+
const config = await Bun.file(`${process.env.RUNNER_TEMP}/mobile.json`).json();
|
|
190
|
+
if (!config.extra?.eas?.projectId) throw new Error("Link an Expo project first");
|
|
191
|
+
const wanted = {channel: process.env.CHANNEL, projectId: config.extra.eas.projectId, applicationId: config.android.package, runtimeVersion: process.env.RUNTIME};
|
|
192
|
+
const release = await Bun.file(`${process.env.RUNNER_TEMP}/release.json`).json();
|
|
193
|
+
const prior = JSON.parse(/<!-- android (\{[^\n]+\}) -->/.exec(release.body || "")?.[1] || "null");
|
|
194
|
+
const reusable = prior && Object.keys(wanted).every(k => prior[k] === wanted[k]) && /^[a-f0-9]{64}$/.test(prior.sha256 || "") && release.assets.some(a => a.name === "android.apk" && a.state === "uploaded" && a.size > 0 && a.digest === `sha256:${prior.sha256}`);
|
|
195
|
+
console.log(`build=${!reusable}\nruntime=${wanted.runtimeVersion}\nmanifest=${JSON.stringify(wanted)}\ntag=${reusable ? release.tag_name : ""}\nsha=${reusable ? prior.sha256 : ""}`);
|
|
196
|
+
' >> "$GITHUB_OUTPUT"
|
|
197
|
+
- name: Update
|
|
198
|
+
if: steps.fingerprint.outputs.build == 'false'
|
|
199
|
+
env:
|
|
200
|
+
TAG: ${{ steps.fingerprint.outputs.tag }}
|
|
201
|
+
SHA: ${{ steps.fingerprint.outputs.sha }}
|
|
202
|
+
RUNTIME: ${{ steps.fingerprint.outputs.runtime }}
|
|
203
|
+
MANIFEST: ${{ steps.fingerprint.outputs.manifest }}
|
|
204
|
+
run: |
|
|
205
|
+
mkdir -p dist/release
|
|
206
|
+
gh release download "$TAG" --pattern android.apk --dir dist/release
|
|
207
|
+
echo "$SHA dist/release/android.apk" | sha256sum --check
|
|
208
|
+
cd apps/mobile
|
|
209
|
+
bun x --no-install expo export --platform android --output-dir dist/update
|
|
210
|
+
test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
|
|
211
|
+
test "$(gh api "repos/$GH_REPO/$SOURCE_PATH" --jq 'if has("head") then (if .state == "open" then .head.sha else "closed" end) else .object.sha end')" = "$SOURCE"
|
|
212
|
+
bun x "$EAS_CLI" update --platform android --channel "$CHANNEL" --environment "$EAS_ENVIRONMENT" --skip-bundler --input-dir dist/update --message "$SOURCE" --non-interactive
|
|
213
|
+
jq --arg sha "$SHA" '. + {sha256: $sha, action: "update"}' <<< "$MANIFEST" > ../../dist/release/android.json
|
|
214
|
+
- name: iOS
|
|
215
|
+
id: ios
|
|
216
|
+
if: steps.platforms.outputs.ios == 'true'
|
|
217
|
+
working-directory: apps/mobile
|
|
218
|
+
run: |
|
|
219
|
+
runtime() { bun x --no-install expo-updates runtimeversion:resolve --platform ios --workflow managed | jq -er '.runtimeVersion | select(test("^[a-f0-9]{40,64}$"))'; }
|
|
220
|
+
fingerprint=$(runtime)
|
|
221
|
+
bun x --no-install expo config --json > "$RUNNER_TEMP/ios-config.json"
|
|
222
|
+
gh api "repos/$GH_REPO/releases?per_page=100" --paginate --slurp | jq --arg tag "$RELEASE_PREFIX-$CHANNEL-ios" 'add | map(select(.draft | not) | select(.tag_name == $tag or (.tag_name | startswith($tag + "-")))) | .[0] // {}' > "$RUNNER_TEMP/ios-release.json"
|
|
223
|
+
RUNTIME="$fingerprint" bun -e '
|
|
224
|
+
const config = await Bun.file(`${process.env.RUNNER_TEMP}/ios-config.json`).json();
|
|
225
|
+
const wanted = {channel: process.env.CHANNEL, projectId: config.extra.eas.projectId, applicationId: config.ios.bundleIdentifier, runtimeVersion: process.env.RUNTIME};
|
|
226
|
+
const release = await Bun.file(`${process.env.RUNNER_TEMP}/ios-release.json`).json();
|
|
227
|
+
const prior = JSON.parse(/<!-- ios (\{[^\n]+\}) -->/.exec(release.body || "")?.[1] || "null");
|
|
228
|
+
const reusable = prior && Object.keys(wanted).every(k => prior[k] === wanted[k]) && Date.parse(prior.expiresAt) > Date.now() && /^[a-f0-9]{64}$/.test(prior.sha256 || "") && release.assets.some(a => a.name === "ios.ipa" && a.state === "uploaded" && a.size > 0 && a.digest === `sha256:${prior.sha256}`);
|
|
229
|
+
await Bun.write(`${process.env.RUNNER_TEMP}/ios-build`, String(!reusable));
|
|
230
|
+
console.log(`build=${!reusable}\nmanifest=${JSON.stringify(wanted)}`);
|
|
231
|
+
' >> "$GITHUB_OUTPUT"
|
|
232
|
+
if [[ $(cat "$RUNNER_TEMP/ios-build") == true ]]; then echo "iOS needs a new signed IPA; the iOS job will build it." >> "$GITHUB_STEP_SUMMARY"; exit 0; fi
|
|
233
|
+
bun x --no-install expo export --platform ios --output-dir dist/update-ios
|
|
234
|
+
test "$(runtime)" = "$fingerprint"
|
|
235
|
+
test "$(gh api "repos/$GH_REPO/$SOURCE_PATH" --jq 'if has("head") then (if .state == "open" then .head.sha else "closed" end) else .object.sha end')" = "$SOURCE"
|
|
236
|
+
bun x "$EAS_CLI" update --platform ios --channel "$CHANNEL" --environment "$EAS_ENVIRONMENT" --skip-bundler --input-dir dist/update-ios --message "$SOURCE" --non-interactive
|
|
237
|
+
if [[ "$CHANNEL" != production ]]; then
|
|
238
|
+
test "$(gh api "repos/$GH_REPO/$SOURCE_PATH" --jq .head.sha)" = "$SOURCE"
|
|
239
|
+
tag=$(jq -r .tag_name "$RUNNER_TEMP/ios-release.json")
|
|
240
|
+
jq -r --arg source "$SOURCE" '.body | sub("(?m)^Source: [a-f0-9]+"; "Source: " + $source)' "$RUNNER_TEMP/ios-release.json" > "$RUNNER_TEMP/ios-notes.md"
|
|
241
|
+
gh api --method PATCH "repos/$GH_REPO/git/refs/tags/$tag" -f sha="$SOURCE" -F force=true > /dev/null
|
|
242
|
+
gh release edit "$tag" --notes-file "$RUNNER_TEMP/ios-notes.md"
|
|
243
|
+
fi
|
|
244
|
+
echo "iOS update published to $CHANNEL." >> "$GITHUB_STEP_SUMMARY"
|
|
245
|
+
- &publish
|
|
246
|
+
name: Publish
|
|
247
|
+
if: github.job == 'ios' || github.job == 'android' || (github.job == 'web' && hashFiles('dist/release/android.json') != '') || steps.platforms.outputs.selected == 'true'
|
|
248
|
+
shell: bash
|
|
249
|
+
run: |
|
|
250
|
+
check_source() { test "$(gh api "repos/$GH_REPO/$SOURCE_PATH" --jq 'if has("head") then (if .state == "open" then .head.sha else "closed" end) else .object.sha end')" = "$SOURCE"; }
|
|
251
|
+
check_source
|
|
252
|
+
for file in dist/release/*; do test -f "$file"; test -s "$file"; done
|
|
253
|
+
case "$PLATFORM" in
|
|
254
|
+
android) test -s dist/release/android.apk; test -s dist/release/android.json ;;
|
|
255
|
+
ios) test -s dist/release/ios.ipa; test -s dist/release/ios.json ;;
|
|
256
|
+
linux) compgen -G 'dist/release/*.deb' > /dev/null; compgen -G 'dist/release/*.rpm' > /dev/null ;;
|
|
257
|
+
windows) compgen -G 'dist/release/*.exe' > /dev/null; compgen -G 'dist/release/*.nupkg' > /dev/null; test -s dist/release/RELEASES ;;
|
|
258
|
+
macos) compgen -G 'dist/release/*.dmg' > /dev/null ;;
|
|
259
|
+
*) exit 1 ;;
|
|
260
|
+
esac
|
|
261
|
+
TAG="$RELEASE_PREFIX-$CHANNEL-$PLATFORM"
|
|
262
|
+
if [[ '${{ github.event_name }}' == push ]]; then TAG+="-${{ github.run_id }}-${{ github.run_attempt }}"; fi
|
|
263
|
+
printf "Platform: %s\nSource: %s\n" "$PLATFORM" "$SOURCE" > notes.md
|
|
264
|
+
if [[ -f dist/release/macos.txt ]]; then cat dist/release/macos.txt >> notes.md; fi
|
|
265
|
+
if [[ -f dist/release/android.json ]]; then echo "<!-- android $(jq -c . dist/release/android.json) -->" >> notes.md; fi
|
|
266
|
+
if [[ -f dist/release/ios.json ]]; then echo "<!-- ios $(jq -c . dist/release/ios.json) -->" >> notes.md; fi
|
|
267
|
+
if gh release view "$TAG" --json assets > previous.json; then
|
|
268
|
+
check_source
|
|
269
|
+
gh release upload "$TAG" dist/release/* --clobber
|
|
270
|
+
while IFS= read -r asset; do
|
|
271
|
+
asset=${asset%$'\r'}
|
|
272
|
+
if [[ ! -f "dist/release/$asset" ]]; then check_source; gh release delete-asset "$TAG" "$asset" --yes; fi
|
|
273
|
+
done < <(jq -r '.assets[].name' previous.json)
|
|
274
|
+
check_source
|
|
275
|
+
if [[ '${{ github.event_name }}' == pull_request ]]; then gh api --method PATCH "repos/$GH_REPO/git/refs/tags/$TAG" -f sha="$SOURCE" -F force=true > /dev/null; fi
|
|
276
|
+
else
|
|
277
|
+
gh release create "$TAG" dist/release/* --draft --target "$SOURCE" --title "$CHANNEL / $PLATFORM" --notes-file notes.md --prerelease=${{ github.event_name == 'pull_request' }}
|
|
278
|
+
fi
|
|
279
|
+
check_source
|
|
280
|
+
gh release edit "$TAG" --title "$CHANNEL / $PLATFORM" --notes-file notes.md --draft=false --prerelease=${{ github.event_name == 'pull_request' }} --latest=false
|
|
281
|
+
echo "Release: https://github.com/$GH_REPO/releases/tag/$TAG" >> "$GITHUB_STEP_SUMMARY"
|
|
282
|
+
|
|
283
|
+
android:
|
|
284
|
+
name: Android
|
|
285
|
+
needs: web
|
|
286
|
+
if: needs.web.outputs.android_build == 'true'
|
|
287
|
+
permissions: *release-permissions
|
|
288
|
+
runs-on: *linux-runner
|
|
289
|
+
timeout-minutes: 60
|
|
290
|
+
env:
|
|
291
|
+
PLATFORM: android
|
|
292
|
+
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
|
|
293
|
+
EXPO_PROJECT_ID: ${{ vars.EXPO_PROJECT_ID }}
|
|
294
|
+
EXPO_OWNER: ${{ vars.EXPO_OWNER }}
|
|
295
|
+
EXPO_SLUG: ${{ vars.EXPO_SLUG }}
|
|
296
|
+
EXPO_NO_DOTENV: '1'
|
|
297
|
+
CONVEX_URL: ${{ needs.web.outputs.convex_url }}
|
|
298
|
+
CONVEX_SITE_URL: ${{ needs.web.outputs.convex_site_url }}
|
|
299
|
+
EXPO_PUBLIC_CONVEX_URL: ${{ needs.web.outputs.convex_url }}
|
|
300
|
+
EXPO_PUBLIC_CONVEX_SITE_URL: ${{ needs.web.outputs.convex_site_url }}
|
|
301
|
+
steps:
|
|
302
|
+
- *checkout
|
|
303
|
+
- *platforms
|
|
304
|
+
- *node
|
|
305
|
+
- *bun
|
|
306
|
+
- *cache
|
|
307
|
+
- *install
|
|
308
|
+
- *expo
|
|
309
|
+
- name: Java
|
|
310
|
+
uses: actions/setup-java@v5
|
|
311
|
+
with: {distribution: temurin, java-version: '17'}
|
|
312
|
+
- name: SDK
|
|
313
|
+
uses: android-actions/setup-android@v3
|
|
314
|
+
with: {packages: platform-tools}
|
|
315
|
+
- name: Gradle
|
|
316
|
+
uses: gradle/actions/setup-gradle@v4
|
|
317
|
+
with: {cache-read-only: false}
|
|
318
|
+
- name: Build
|
|
319
|
+
working-directory: apps/mobile
|
|
320
|
+
env:
|
|
321
|
+
RUNTIME: ${{ needs.web.outputs.android_runtime }}
|
|
322
|
+
DISPOSABL_ANDROID_CHANNEL: *channel
|
|
323
|
+
MANIFEST: ${{ needs.web.outputs.android_manifest }}
|
|
324
|
+
ANDROID_KEYSTORE_BASE64: ${{ github.event_name == 'push' && secrets.ANDROID_KEYSTORE_BASE64 || '' }}
|
|
325
|
+
ANDROID_KEYSTORE_PASSWORD: ${{ github.event_name == 'push' && secrets.ANDROID_KEYSTORE_PASSWORD || '' }}
|
|
326
|
+
ANDROID_KEY_ALIAS: ${{ github.event_name == 'push' && secrets.ANDROID_KEY_ALIAS || '' }}
|
|
327
|
+
ANDROID_KEY_PASSWORD: ${{ github.event_name == 'push' && secrets.ANDROID_KEY_PASSWORD || '' }}
|
|
328
|
+
run: |
|
|
329
|
+
test "$(gh api "repos/$GH_REPO/$SOURCE_PATH" --jq 'if has("head") then (if .state == "open" then .head.sha else "closed" end) else .object.sha end')" = "$SOURCE"
|
|
330
|
+
if [[ "$CHANNEL" == production ]]; then
|
|
331
|
+
: "${ANDROID_KEYSTORE_BASE64:?}" "${ANDROID_KEYSTORE_PASSWORD:?}" "${ANDROID_KEY_ALIAS:?}" "${ANDROID_KEY_PASSWORD:?}"
|
|
332
|
+
export ANDROID_KEYSTORE_PATH="$RUNNER_TEMP/android-release.jks"
|
|
333
|
+
trap 'rm -f "$ANDROID_KEYSTORE_PATH"' EXIT
|
|
334
|
+
(umask 077; printf '%s' "$ANDROID_KEYSTORE_BASE64" | base64 --decode > "$ANDROID_KEYSTORE_PATH")
|
|
335
|
+
fi
|
|
336
|
+
bun x --no-install expo prebuild --platform android --no-install
|
|
337
|
+
test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
|
|
338
|
+
(cd android && ./gradlew :app:assembleRelease --no-daemon --build-cache)
|
|
339
|
+
apk=android/app/build/outputs/apk/release/app-release.apk
|
|
340
|
+
test "$(unzip -p "$apk" assets/fingerprint)" = "$RUNTIME"
|
|
341
|
+
test "$(bun x --no-install expo-updates runtimeversion:resolve --platform android --workflow managed | jq -er .runtimeVersion)" = "$RUNTIME"
|
|
342
|
+
mkdir -p ../../dist/release
|
|
343
|
+
cp "$apk" ../../dist/release/android.apk
|
|
344
|
+
jq --arg sha "$(sha256sum "$apk" | cut -d' ' -f1)" '. + {sha256: $sha, action: "build"}' <<< "$MANIFEST" > ../../dist/release/android.json
|
|
345
|
+
- *publish
|
|
346
|
+
|
|
347
|
+
ios:
|
|
348
|
+
name: iOS
|
|
349
|
+
needs: web
|
|
350
|
+
if: needs.web.outputs.ios_build == 'true'
|
|
351
|
+
permissions: *release-permissions
|
|
352
|
+
runs-on: *macos-runner
|
|
353
|
+
timeout-minutes: 60
|
|
354
|
+
env:
|
|
355
|
+
PLATFORM: ios
|
|
356
|
+
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
|
|
357
|
+
EXPO_PROJECT_ID: ${{ vars.EXPO_PROJECT_ID }}
|
|
358
|
+
EXPO_OWNER: ${{ vars.EXPO_OWNER }}
|
|
359
|
+
EXPO_SLUG: ${{ vars.EXPO_SLUG }}
|
|
360
|
+
EXPO_NO_DOTENV: '1'
|
|
361
|
+
CONVEX_URL: ${{ needs.web.outputs.convex_url }}
|
|
362
|
+
CONVEX_SITE_URL: ${{ needs.web.outputs.convex_site_url }}
|
|
363
|
+
EXPO_PUBLIC_CONVEX_URL: ${{ needs.web.outputs.convex_url }}
|
|
364
|
+
EXPO_PUBLIC_CONVEX_SITE_URL: ${{ needs.web.outputs.convex_site_url }}
|
|
365
|
+
MANIFEST: ${{ needs.web.outputs.ios_manifest }}
|
|
366
|
+
steps:
|
|
367
|
+
- *checkout
|
|
368
|
+
- *platforms
|
|
369
|
+
- *node
|
|
370
|
+
- *bun
|
|
371
|
+
- *cache
|
|
372
|
+
- *install
|
|
373
|
+
- *expo
|
|
374
|
+
- name: Pods
|
|
375
|
+
uses: actions/cache@v4
|
|
376
|
+
with:
|
|
377
|
+
path: ~/Library/Caches/CocoaPods
|
|
378
|
+
key: pods-${{ runner.arch }}-${{ hashFiles('bun.lock') }}
|
|
379
|
+
restore-keys: pods-${{ runner.arch }}-
|
|
380
|
+
- name: Build
|
|
381
|
+
working-directory: apps/mobile
|
|
382
|
+
run: |
|
|
383
|
+
test "$(gh api "repos/$GH_REPO/$SOURCE_PATH" --jq 'if has("head") then (if .state == "open" then .head.sha else "closed" end) else .object.sha end')" = "$SOURCE"
|
|
384
|
+
mkdir -p ../../dist/release
|
|
385
|
+
bun x "$EAS_CLI" build --platform ios --profile "ios-$EAS_ENVIRONMENT" --local --non-interactive --output ../../dist/release/ios.ipa
|
|
386
|
+
- name: Verify
|
|
387
|
+
run: |
|
|
388
|
+
unzip -q dist/release/ios.ipa -d "$RUNNER_TEMP/ipa"
|
|
389
|
+
apps=("$RUNNER_TEMP/ipa/Payload/"*.app)
|
|
390
|
+
test "${#apps[@]}" -eq 1
|
|
391
|
+
app=${apps[0]}
|
|
392
|
+
codesign --verify --deep --strict "$app"
|
|
393
|
+
test "$(plutil -extract CFBundleIdentifier raw -o - "$app/Info.plist")" = "$(jq -r .applicationId <<< "$MANIFEST")"
|
|
394
|
+
runtime=$(plutil -extract EXUpdatesRuntimeVersion raw -o - "$app/Expo.plist")
|
|
395
|
+
if [[ "$runtime" == "file:fingerprint" ]]; then
|
|
396
|
+
fingerprints=()
|
|
397
|
+
while IFS= read -r path; do fingerprints+=("$path"); done < <(find "$app" -path '*/EXUpdates.bundle/fingerprint' -type f)
|
|
398
|
+
if [[ ${#fingerprints[@]} -ne 1 ]]; then
|
|
399
|
+
echo "Expected one EXUpdates.bundle/fingerprint, found ${#fingerprints[@]}" >&2
|
|
400
|
+
exit 1
|
|
401
|
+
fi
|
|
402
|
+
runtime=$(cat "${fingerprints[0]}")
|
|
403
|
+
fi
|
|
404
|
+
expected_runtime=$(jq -r .runtimeVersion <<< "$MANIFEST")
|
|
405
|
+
if [[ "$runtime" != "$expected_runtime" ]]; then
|
|
406
|
+
echo "iOS runtime version mismatch: expected $expected_runtime, found $runtime" >&2
|
|
407
|
+
exit 1
|
|
408
|
+
fi
|
|
409
|
+
test "$(plutil -extract EXUpdatesRequestHeaders.expo-channel-name raw -o - "$app/Expo.plist")" = "$CHANNEL"
|
|
410
|
+
security cms -D -i "$app/embedded.mobileprovision" > "$RUNNER_TEMP/profile.plist"
|
|
411
|
+
expires=$(python3 -c 'import datetime,plistlib,sys; p=plistlib.load(open(sys.argv[1],"rb")); expiry=p["ExpirationDate"].replace(tzinfo=datetime.timezone.utc); assert p.get("ProvisionedDevices") and not p["Entitlements"].get("get-task-allow",False) and expiry>datetime.datetime.now(datetime.timezone.utc); print(expiry.isoformat())' "$RUNNER_TEMP/profile.plist")
|
|
412
|
+
jq --arg sha "$(shasum -a 256 dist/release/ios.ipa | cut -d' ' -f1)" --arg expires "$expires" '. + {sha256: $sha, expiresAt: $expires}' <<< "$MANIFEST" > dist/release/ios.json
|
|
413
|
+
- *publish
|
|
414
|
+
|
|
415
|
+
desktop:
|
|
416
|
+
permissions: *release-permissions
|
|
417
|
+
name: ${{ matrix.platform }}
|
|
418
|
+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
|
|
419
|
+
strategy:
|
|
420
|
+
fail-fast: false
|
|
421
|
+
matrix:
|
|
422
|
+
include:
|
|
423
|
+
- {platform: linux, runner: *linux-runner}
|
|
424
|
+
- {platform: windows, runner: *windows-runner}
|
|
425
|
+
- {platform: macos, runner: *macos-runner}
|
|
426
|
+
runs-on: ${{ matrix.runner }}
|
|
427
|
+
timeout-minutes: 30
|
|
428
|
+
env:
|
|
429
|
+
PLATFORM: ${{ matrix.platform }}
|
|
430
|
+
DISPOSABL_DESKTOP_PLATFORM: ${{ matrix.platform }}
|
|
431
|
+
MACOS_NOTARIZE: ${{ secrets.MACOS_CERTIFICATES_P12_PRODUCTION != '' && secrets.MACOS_CERTIFICATES_PASSWORD_PRODUCTION != '' && secrets.MACOS_APPLE_API_KEY_P8_PRODUCTION != '' && secrets.MACOS_APPLE_API_KEY_ID_PRODUCTION != '' && secrets.MACOS_APPLE_API_ISSUER_PRODUCTION != '' }}
|
|
432
|
+
electron_config_cache: ${{ github.workspace }}/.cache/electron
|
|
433
|
+
steps:
|
|
434
|
+
- *checkout
|
|
435
|
+
- *platforms
|
|
436
|
+
- *node
|
|
437
|
+
- *bun
|
|
438
|
+
- *cache
|
|
439
|
+
- *install
|
|
440
|
+
- name: Electron
|
|
441
|
+
if: steps.platforms.outputs.selected == 'true'
|
|
442
|
+
uses: actions/cache@v4
|
|
443
|
+
with:
|
|
444
|
+
path: .cache/electron
|
|
445
|
+
key: electron-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('bun.lock') }}
|
|
446
|
+
- name: Packages
|
|
447
|
+
if: steps.platforms.outputs.selected == 'true' && matrix.platform == 'linux'
|
|
448
|
+
run: command -v fakeroot && command -v rpmbuild && command -v dpkg-deb || { sudo apt-get update && sudo apt-get install -y fakeroot dpkg rpm; }
|
|
449
|
+
# Apple credentials are optional for both previews and production.
|
|
450
|
+
- name: Sign
|
|
451
|
+
if: steps.platforms.outputs.selected == 'true' && matrix.platform == 'macos' && env.MACOS_NOTARIZE == 'true'
|
|
452
|
+
uses: apple-actions/import-codesign-certs@v7.2.0
|
|
453
|
+
with:
|
|
454
|
+
p12-file-base64: ${{ secrets.MACOS_CERTIFICATES_P12_PRODUCTION }}
|
|
455
|
+
p12-password: ${{ secrets.MACOS_CERTIFICATES_PASSWORD_PRODUCTION }}
|
|
456
|
+
- name: Notary
|
|
457
|
+
if: steps.platforms.outputs.selected == 'true' && matrix.platform == 'macos' && env.MACOS_NOTARIZE == 'true'
|
|
458
|
+
env:
|
|
459
|
+
API_KEY_P8: ${{ secrets.MACOS_APPLE_API_KEY_P8_PRODUCTION }}
|
|
460
|
+
API_KEY_ID: ${{ secrets.MACOS_APPLE_API_KEY_ID_PRODUCTION }}
|
|
461
|
+
API_ISSUER: ${{ secrets.MACOS_APPLE_API_ISSUER_PRODUCTION }}
|
|
462
|
+
run: |
|
|
463
|
+
: "${API_KEY_P8:?Configure MACOS_APPLE_API_KEY_P8_PRODUCTION}" "${API_KEY_ID:?Configure MACOS_APPLE_API_KEY_ID_PRODUCTION}" "${API_ISSUER:?Configure MACOS_APPLE_API_ISSUER_PRODUCTION}"
|
|
464
|
+
umask 077
|
|
465
|
+
printf '%s' "$API_KEY_P8" > "$RUNNER_TEMP/notary.p8"
|
|
466
|
+
printf 'APPLE_API_KEY=%s\nAPPLE_API_KEY_ID=%s\nAPPLE_API_ISSUER=%s\n' "$RUNNER_TEMP/notary.p8" "$API_KEY_ID" "$API_ISSUER" >> "$GITHUB_ENV"
|
|
467
|
+
- name: Build
|
|
468
|
+
if: steps.platforms.outputs.selected == 'true'
|
|
469
|
+
run: bun run --cwd apps/desktop preview
|
|
470
|
+
- name: Verify
|
|
471
|
+
if: steps.platforms.outputs.selected == 'true' && matrix.platform == 'macos'
|
|
472
|
+
run: |
|
|
473
|
+
images=(dist/release/*.dmg)
|
|
474
|
+
test "${#images[@]}" -eq 1 && test -s "${images[0]}"
|
|
475
|
+
mkdir -p "$RUNNER_TEMP/macos-verify"
|
|
476
|
+
hdiutil attach "${images[0]}" -readonly -nobrowse -mountpoint "$RUNNER_TEMP/macos-verify"
|
|
477
|
+
trap 'hdiutil detach "$RUNNER_TEMP/macos-verify"' EXIT
|
|
478
|
+
apps=("$RUNNER_TEMP/macos-verify/"*.app)
|
|
479
|
+
test "${#apps[@]}" -eq 1 && test -d "${apps[0]}"
|
|
480
|
+
codesign --verify --deep --strict "${apps[0]}"
|
|
481
|
+
if [[ "$MACOS_NOTARIZE" == true ]]; then
|
|
482
|
+
spctl --assess --type execute --verbose "${apps[0]}"
|
|
483
|
+
xcrun stapler validate "${apps[0]}"
|
|
484
|
+
echo 'macOS: Apple Silicon, Developer ID signed and notarized.' > dist/release/macos.txt
|
|
485
|
+
else
|
|
486
|
+
echo 'macOS: Apple Silicon, ad hoc signed and NOT notarized. If blocked, use System Settings > Privacy & Security > Open Anyway. https://support.apple.com/102445' > dist/release/macos.txt
|
|
487
|
+
fi
|
|
488
|
+
cat dist/release/macos.txt >> "$GITHUB_STEP_SUMMARY"
|
|
489
|
+
- *publish
|
|
490
|
+
- name: Clean
|
|
491
|
+
if: always() && matrix.platform == 'macos'
|
|
492
|
+
run: rm -f "$RUNNER_TEMP/notary.p8"
|
|
@@ -30,29 +30,59 @@ the project scripts; Forge and Electron still use Node.js.
|
|
|
30
30
|
| -------- | -------------------- | ------------------------------------------ | -------------- |
|
|
31
31
|
| Windows | x64 | Squirrel `Setup.exe`, `.nupkg`, `RELEASES` | `make:windows` |
|
|
32
32
|
| Linux | x64 | `.deb` and `.rpm` | `make:linux` |
|
|
33
|
-
| macOS | arm64, Apple Silicon | `.
|
|
33
|
+
| macOS | arm64, Apple Silicon | `.dmg` containing the `.app` | `make:macos` |
|
|
34
34
|
|
|
35
35
|
Run each script with `bun run --cwd apps/desktop <script>`. Packaging rejects other
|
|
36
36
|
platform and architecture combinations, including Windows ARM and Intel macOS.
|
|
37
37
|
Build Windows installers on Windows, Linux packages on Linux, and macOS packages
|
|
38
38
|
on macOS. Linux builders need `fakeroot`, `dpkg`, and `rpm` installed.
|
|
39
39
|
|
|
40
|
-
##
|
|
40
|
+
## CI releases
|
|
41
41
|
|
|
42
|
-
The
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Uploads create a draft release for review before making the downloads public.
|
|
46
|
-
|
|
47
|
-
With `GITHUB_TOKEN` supplied in the environment, run the matching `make:*` script
|
|
48
|
-
on each platform, followed by:
|
|
42
|
+
The single root `.github/workflows/pipeline.yml` selects affected desktop targets from
|
|
43
|
+
`disposabl.json`. Windows x64, Linux x64 and macOS arm64 build in parallel alongside
|
|
44
|
+
web/backend deployment on Blacksmith. Each runner uses:
|
|
49
45
|
|
|
50
46
|
```sh
|
|
51
|
-
bun run --cwd apps/desktop
|
|
47
|
+
DISPOSABL_DESKTOP_PLATFORM=linux DISPOSABL_RELEASE_VERSION=1.0.42 bun run --cwd apps/desktop preview
|
|
52
48
|
```
|
|
53
49
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
Use the matching platform value on Windows or macOS. The helper temporarily sets
|
|
51
|
+
the package version, makes the installers, restores `package.json` even on failure,
|
|
52
|
+
and collects outputs into the repository root `dist/release`. Each platform job
|
|
53
|
+
then uploads directly to its own GitHub prerelease using its job-scoped write
|
|
54
|
+
token, without waiting for other platforms. PR tags such as `app-pr-2-macos` stay
|
|
55
|
+
constant while their assets and source commit update after successful builds.
|
|
56
|
+
Main releases use separate platform/run tags. Forge itself does not publish.
|
|
57
|
+
|
|
58
|
+
Windows and Linux installers are unsigned. macOS builds use ad hoc signing by
|
|
59
|
+
default; Developer ID signing and notarization are optional. In-app updates are not configured. The release version is
|
|
60
|
+
`1.0.<workflow run number>`. See the root `.github/README.md` for release behavior.
|
|
61
|
+
|
|
62
|
+
## macOS signing
|
|
63
|
+
|
|
64
|
+
To enable Developer ID signing and notarization, configure all five repository
|
|
65
|
+
secrets, or grant this repository access to equivalent organization secrets:
|
|
66
|
+
|
|
67
|
+
- `MACOS_CERTIFICATES_P12_PRODUCTION`: base64-encoded Developer ID Application
|
|
68
|
+
certificate and private key exported as `.p12`.
|
|
69
|
+
- `MACOS_CERTIFICATES_PASSWORD_PRODUCTION`: the `.p12` export password.
|
|
70
|
+
- `MACOS_APPLE_API_KEY_P8_PRODUCTION`: the raw App Store Connect API private key.
|
|
71
|
+
- `MACOS_APPLE_API_KEY_ID_PRODUCTION`: its Key ID.
|
|
72
|
+
- `MACOS_APPLE_API_ISSUER_PRODUCTION`: its Issuer ID.
|
|
73
|
+
|
|
74
|
+
With all five secrets present, the same credentials sign and notarize prereleases
|
|
75
|
+
and production releases. The suffix is a naming convention. The workflow imports
|
|
76
|
+
the certificate into a temporary keychain, lets Forge sign, notarize and staple
|
|
77
|
+
the app, and checks the app mounted from the DMG with `codesign`, Gatekeeper and `stapler`.
|
|
78
|
+
The keychain and temporary notarization key are cleaned up. Configured signing or
|
|
79
|
+
notarization failures stop publication; they do not silently downgrade the app.
|
|
80
|
+
|
|
81
|
+
Without the complete credential set, previews and production still publish an ad
|
|
82
|
+
hoc signed DMG. This signature does not verify the developer's identity. The
|
|
83
|
+
release notes identify it as unnotarized and link to Apple's installation guidance.
|
|
84
|
+
Users may need **System Settings > Privacy & Security > Open Anyway**; managed Macs
|
|
85
|
+
may disallow this. Local `make:macos` builds also use ad hoc signing by default.
|
|
58
86
|
|
|
87
|
+
Change `MACOS_BUNDLE_ID` at the top of the workflow to set your desktop bundle
|
|
88
|
+
identifier. CI builds only Apple Silicon (`arm64`), never Intel macOS packages.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { cp, mkdir, readFile, readdir, rm, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
|
|
6
|
+
const root = fileURLToPath(new URL('.', import.meta.url));
|
|
7
|
+
const targets = {
|
|
8
|
+
windows: ['win32', 'x64'],
|
|
9
|
+
linux: ['linux', 'x64'],
|
|
10
|
+
macos: ['darwin', 'arm64'],
|
|
11
|
+
};
|
|
12
|
+
const target = process.env.DISPOSABL_DESKTOP_PLATFORM;
|
|
13
|
+
const version = process.env.DISPOSABL_RELEASE_VERSION;
|
|
14
|
+
if (!Object.hasOwn(targets, target ?? ''))
|
|
15
|
+
throw new Error('Invalid DISPOSABL_DESKTOP_PLATFORM');
|
|
16
|
+
if (!version || !/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(version))
|
|
17
|
+
throw new Error('DISPOSABL_RELEASE_VERSION must be numeric semver');
|
|
18
|
+
if (
|
|
19
|
+
process.platform !== targets[target][0] ||
|
|
20
|
+
process.arch !== targets[target][1]
|
|
21
|
+
)
|
|
22
|
+
throw new Error(`Build ${target} on ${targets[target].join('/')}`);
|
|
23
|
+
const packagePath = join(root, 'package.json');
|
|
24
|
+
const original = await readFile(packagePath, 'utf8');
|
|
25
|
+
try {
|
|
26
|
+
await rm(join(root, 'out'), { recursive: true, force: true });
|
|
27
|
+
await rm(join(root, '../../dist/release'), { recursive: true, force: true });
|
|
28
|
+
await writeFile(
|
|
29
|
+
packagePath,
|
|
30
|
+
JSON.stringify({ ...JSON.parse(original), version }, null, 2) + '\n',
|
|
31
|
+
);
|
|
32
|
+
const result = spawnSync('bun', ['run', `make:${target}`], {
|
|
33
|
+
cwd: root,
|
|
34
|
+
stdio: 'inherit',
|
|
35
|
+
});
|
|
36
|
+
if (result.status !== 0)
|
|
37
|
+
throw new Error(`Forge failed: ${result.error ?? result.status}`);
|
|
38
|
+
const destination = join(root, '../../dist/release');
|
|
39
|
+
await mkdir(destination, { recursive: true });
|
|
40
|
+
async function collect(dir) {
|
|
41
|
+
for (const entry of await readdir(dir, { withFileTypes: true })) {
|
|
42
|
+
const path = join(dir, entry.name);
|
|
43
|
+
if (entry.isDirectory()) await collect(path);
|
|
44
|
+
else if (entry.isFile())
|
|
45
|
+
await cp(path, join(destination, entry.name), {
|
|
46
|
+
errorOnExist: true,
|
|
47
|
+
force: false,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
await collect(join(root, 'out', 'make'));
|
|
52
|
+
if (!(await readdir(destination)).length)
|
|
53
|
+
throw new Error('Forge produced no artifacts');
|
|
54
|
+
} finally {
|
|
55
|
+
await writeFile(packagePath, original);
|
|
56
|
+
}
|