Skip to content

config: build profiles with --profile on ios build and ios share - #19

Closed
Interlap01 wants to merge 9 commits into
mainfrom
feat/build-profiles
Closed

Interlap01 wants to merge 9 commits into
mainfrom
feat/build-profiles

Conversation

@Interlap01

@Interlap01 Interlap01 commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Build profiles in builder.json, modeled on eas.json:

"defaultProfile": "development",
"profiles": {
  "development": { "configuration": "Debug", "signing": false },
  "preview":     { "configuration": "Release", "signing": true, "env": { "API_URL": "https://staging.example.com" } },
  "production":  { "configuration": "Release", "signing": true, "scheme": "MyApp", "provider": "codemagic", "distribution": "app-store" }
}
  • builder ios build --profile <name> and builder ios share --profile <name> select a profile; defaultProfile applies when no flag is given. Without either, dispatch inputs and Codemagic/Bitrise parameters are identical to before, pinned by tests.
  • A profile overrides only the fields it sets (configuration, scheme, signing, provider, env, distribution); --unsigned and --provider still win. Unknown names error with the available list. Resolved settings are printed before dispatch.
  • env reaches the runner as one JSON workflow input profile, keeping ios-build.yml under GitHub's ten-input cap with room for the upcoming build number. Resolve parameters writes it to $GITHUB_ENV with a random heredoc delimiter before any dependency or build step; tag-triggered runs read defaultProfile from builder.json. Codemagic/Bitrise receive BUILD_ENV and DISTRIBUTION, exported by runner.sh in prepare().
  • Env names are validated and the runner's own parameters, the signing secrets, PATH/HOME/DEVELOPER_DIR, MOBAI_API_KEY and the GITHUB_/RUNNER_/CM_/BITRISE_/BUILDER_ namespaces are reserved. Env values are build configuration, not secrets: they appear in run inputs and logs, and the README says so.
  • distribution is validated and passed through as steps.params.outputs.distribution / $DISTRIBUTION for the export step to consume in a follow-up.
  • Dispatching with a profile against a committed workflow that predates this change now explains that builder init must be re-run and the workflow committed.

Test plan

  • go build ./... && go vet ./... && go test ./..., gofmt -l . clean
  • builder ios build without a profile on an existing project: same inputs and behavior as before
  • builder ios build --profile preview after builder init: run log shows the env exported and Release
  • builder ios build --profile nope lists the available profiles
  • Tag-triggered build with defaultProfile set picks it up

A profiles map in builder.json, keyed by name, overrides ios.configuration,
ios.scheme, ios.signing and provider, and adds env and the reserved
distribution field. ResolveProfile applies the named profile, or
defaultProfile, over the top-level settings; with neither the result is the
top-level settings unchanged. Unknown names list the available profiles,
and env names that are not identifiers or clash with the runner's own
parameters are rejected. Signing is a *bool so a profile's false can
override a top-level true.
The coordinator resolves the profile, layers --unsigned and --provider on
top, and prints the resolved settings before anything is dispatched. Input
assembly moves into buildInputs/workflowInputs (GitHub) and inputs
(Codemagic/Bitrise) so the mapping is testable. The profile reaches GitHub
as one JSON input, profile, sent only when a profile is selected so older
workflow files keep working; runner.sh receives BUILD_ENV and DISTRIBUTION
variables. The CLI resolves the effective provider first so the GitHub
client and signal handling follow a profile that names a provider.
Resolve parameters takes the profile input on dispatch and, on a tag push,
the profile named by defaultProfile in builder.json, letting its fields
override ios.* (with an explicit null test for signing, since jq's //
treats false as missing). The profile's env is written to GITHUB_ENV before
the dependency and build steps, and runner.sh exports BUILD_ENV at the
start of prepare(). Keys and values are base64 per entry: jq drops NUL
bytes, and a key containing a space must not split into a valid name.
distribution is validated and exposed as an output for the export step.
…ile env

PATH, HOME, DEVELOPER_DIR, the IOS_* signing secrets, MOBAI_API_KEY and the
GITHUB_/RUNNER_/ACTIONS_/CM_/FCI_/BITRISE_/BUILDER_ prefixes are rejected
alongside the runner parameters: runner.sh exports the profile env before
install_signing reads its secrets from the environment. A defaultProfile that
names a missing profile now says so instead of reading as a --profile typo.
…input

GitHub answers 422 'Unexpected inputs provided' when the committed workflow
predates profiles; the error now says to run builder init and push. ios share
drops distribution along with configuration and signing, since the simulator
job ignores it. Pin the no-profile shape of the runner variables and the share
inputs against the pre-profile code.
A value line equal to the fixed __BUILDER_ENV__ delimiter ended the value early
and let the rest be read as new variables. A non-object env failed jq inside a
process substitution, which set -e cannot see, so nothing was exported and the
job carried on; Resolve parameters and runner.sh now fail with a message.
gocritic's hugeParam flags BuildSettings (96 bytes) and BuildOptions (80
bytes) everywhere they are passed by value, and the repo config treats it
as an error. Take *config.BuildSettings in the inputs, progress and remote
helpers, give EnvJSON/ProfileInput pointer receivers, and have
Coordinator.settings hand back a pointer; Build and buildRemote now take
*BuildOptions.

Both take a copy before filling in their defaults, so the caller's
BuildOptions is left exactly as it was passed.
@Interlap01

Copy link
Copy Markdown
Collaborator Author

Folded into #23, which carries these commits with the final profile design.

@Interlap01 Interlap01 closed this Sep 17, 2026
@Interlap01
Interlap01 deleted the feat/build-profiles branch September 17, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant