Skip to content

fix(ci): Xcode Cloud — write Tuist/Signing.xcconfig from env var before tuist generate #91

Closed

Description

@wei18

Symptom

Xcode Cloud build #4 (after #87 + #89 fixed tuist invocation) now fails at tuist generate:

Configuration file not found at path /Volumes/workspace/repository/Tuist/Signing.xcconfig
✖ Error: Fatal linting issues found

Root cause

Project.swift references Tuist/Signing.xcconfig in both Debug + Release configurations (lines 65-66). The file is gitignored (contains DEVELOPMENT_TEAM — a secret per foundations.md §7). Xcode Cloud doesn't have it.

Tuist/Signing.xcconfig.example exists as a template and explicitly notes: "For CI (Xcode Cloud): set DEVELOPMENT_TEAM via a ci_pre_xcodebuild.sh script that writes Signing.xcconfig from an Xcode Cloud environment variable."

But Tuist generate runs in ci_post_clone.sh (earlier than ci_pre_xcodebuild.sh) and lints the missing file, so the write must happen pre-tuist-generate, i.e. in ci_post_clone.sh too.

Fix

In ci_scripts/ci_post_clone.sh, before the tuist install block (block #3), add a block #2.5:

# 2.5) Write Tuist/Signing.xcconfig from Xcode Cloud env var (gitignored secret)
cd "${CI_PRIMARY_REPOSITORY_PATH:-$(dirname "$0")/..}"
if [[ -n "${SUDOKU_DEVELOPMENT_TEAM:-}" ]] && [[ ! -f "Tuist/Signing.xcconfig" ]]; then
    cat > "Tuist/Signing.xcconfig" <<EOF
DEVELOPMENT_TEAM = ${SUDOKU_DEVELOPMENT_TEAM}
EOF
    echo "Wrote Tuist/Signing.xcconfig from SUDOKU_DEVELOPMENT_TEAM env var"
elif [[ ! -f "Tuist/Signing.xcconfig" ]]; then
    echo "ERROR: SUDOKU_DEVELOPMENT_TEAM env var not set; cannot generate Signing.xcconfig"
    exit 1
fi

(Note: the original block #3 already cds to the repo root, so we add the same cd here OR move the cd up to be shared — the subagent should consolidate.)

User-owned setup

User must configure SUDOKU_DEVELOPMENT_TEAM as a custom env var in Xcode Cloud workflow settings (App Store Connect → Apps → Sudoku → Xcode Cloud → Workflow → Environment → add SUDOKU_DEVELOPMENT_TEAM = <team-id>).

Document in docs/v2/v2.5-readiness.md pre-flight section.

Also update Tuist/Signing.xcconfig.example comment block to reference ci_post_clone.sh (not ci_pre_xcodebuild.sh) and the env var name SUDOKU_DEVELOPMENT_TEAM.

Acceptance

Out of scope

  • Migrating to manual signing
  • Storing team ID outside Xcode Cloud secrets

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions