Update bitrise.yml

This commit is contained in:
Daniel Arantes Loverde
2026-07-09 17:23:13 -03:00
parent 0d9ebbd621
commit f94bf26bdc

View File

@@ -9,29 +9,91 @@ meta:
app: app:
envs: envs:
- TEST_SHARD_COUNT: 2
- BITRISE_PROJECT_PATH: PediFoods.xcodeproj
opts:
is_expand: false
- BITRISE_SCHEME: PediFoods App
opts:
is_expand: false
- BITRISE_DISTRIBUTION_METHOD: app-store - BITRISE_DISTRIBUTION_METHOD: app-store
opts: opts:
is_expand: false is_expand: false
- APPLE_ID: developer@loverde.com.br
# MANUAL (Bitrise Secrets tab — never commit these): # MANUAL (Bitrise Secrets tab — never commit these):
# ASC_KEY_ID → App Store Connect API Key ID # ASC_KEY_ID → App Store Connect API Key ID
# ASC_ISSUER_ID → App Store Connect Issuer ID # ASC_ISSUER_ID → App Store Connect Issuer ID
# ASC_KEY_CONTENT → .p8 file content (raw, written verbatim into apikey.json) # ASC_KEY_CONTENT → .p8 file content base64-encoded
# DEVELOPMENT_TEAM → Apple Developer Team ID, written into # ITC_TEAM_ID → iTunes Connect Team ID (numeric)
# Darwin/fastlane/AppStore.xcconfig at build time
# (Darwin/PediFoods.xcconfig leaves it blank on purpose) # ─── PIPELINES ────────────────────────────────────────────────────────────────
# pipelines:
# NOTE: this project builds via fastlane's build_app (gym), not Bitrise's run_tests:
# own xcode-archive/manage-ios-code-signing steps. Darwin/PediFoods.xcconfig workflows:
# sets SDKROOT = auto and SUPPORTED_PLATFORMS = iphoneos iphonesimulator build_for_testing: {}
# macosx (Skip's multi-platform build), and Bitrise's own steps pre-parse test_without_building:
# the project to guess a single platform before invoking xcodebuild — that depends_on:
# parser doesn't understand SDKROOT = auto and fails outright. xcodebuild - build_for_testing
# itself handles it fine; only Bitrise's step-side parser chokes, so we parallel: "$TEST_SHARD_COUNT"
# go through fastlane directly instead.
# ─── WORKFLOWS ──────────────────────────────────────────────────────────────── # ─── WORKFLOWS ────────────────────────────────────────────────────────────────
workflows: workflows:
# ── Parallel test pipeline: step 1 — build only ───────────────────────────
build_for_testing:
description: Build app for testing (no run) — used by run_tests pipeline
steps:
- git-clone@8: {}
- xcode-build-for-test@3:
inputs:
- project_path: $BITRISE_PROJECT_PATH
- scheme: $BITRISE_SCHEME
- simulator_device: iPhone 16
- simulator_os_version: latest
- output_tool: xcpretty
- deploy-to-bitrise-io@2:
inputs:
- pipeline_intermediate_files: "$BITRISE_TEST_BUNDLE_ZIP_PATH:BITRISE_TEST_BUNDLE_ZIP_PATH"
# ── Parallel test pipeline: step 2 — run shards ───────────────────────────
test_without_building:
description: Run test shards in parallel — depends on build_for_testing
steps:
- pull-intermediate-files@1:
inputs:
- artifact_sources: build_for_testing
- xcode-test-without-building@0:
inputs:
- xctestrun: $BITRISE_TEST_BUNDLE_ZIP_PATH
- destination: platform=iOS Simulator,name=iPhone 16,OS=latest
- test_shard_index: $BITRISE_IO_PARALLEL_INDEX
- total_number_of_shards: $TEST_SHARD_COUNT
- generate_code_coverage_files: "yes"
# ── Metadata push (no build) ───────────────────────────────────────────────
metadata:
description: Push App Store metadata and screenshots for all languages
steps:
- git-clone@8: {}
- fastlane@3:
inputs:
- lane: metadata
- work_dir: $BITRISE_SOURCE_DIR
# ── Simple single-machine test (non-parallel) ──────────────────────────────
test:
description: Run unit tests (single machine, for PR checks)
steps:
- git-clone@8: {}
- xcode-test@5:
inputs:
- project_path: $BITRISE_PROJECT_PATH
- scheme: $BITRISE_SCHEME
- simulator_device: iPhone 16
- simulator_os_version: latest
- should_build_before_test: "yes"
- generate_code_coverage_files: "yes"
# ── Beta → TestFlight ────────────────────────────────────────────────────── # ── Beta → TestFlight ──────────────────────────────────────────────────────
beta: beta:
description: Build, sign, and upload to TestFlight description: Build, sign, and upload to TestFlight
@@ -42,80 +104,79 @@ workflows:
inputs: inputs:
- content: | - content: |
cd $BITRISE_SOURCE_DIR cd $BITRISE_SOURCE_DIR
# CURRENT_PROJECT_VERSION lives in Skip.env — shared by both agvtool new-version -all $BITRISE_BUILD_NUMBER
# Darwin/PediFoods.xcconfig and Android/settings.gradle.kts, - manage-ios-code-signing@2:
# not a standard Xcode "Apple Generic Versioning" setting,
# so agvtool does not apply here.
sed -i '' "s/CURRENT_PROJECT_VERSION = .*/CURRENT_PROJECT_VERSION = $BITRISE_BUILD_NUMBER/" Skip.env
- script@1:
title: Write code signing team and App Store Connect API key
inputs: inputs:
- content: | - distribution_method: app-store
echo "DEVELOPMENT_TEAM = $DEVELOPMENT_TEAM" >> "$BITRISE_SOURCE_DIR/Darwin/fastlane/AppStore.xcconfig" - project_path: $BITRISE_PROJECT_PATH
# ASC_KEY_CONTENT is the raw multi-line .p8 PEM content — build - scheme: $BITRISE_SCHEME
# the JSON with Ruby's encoder so its embedded newlines get # MANUAL: Upload .p12 cert + .mobileprovision in
# escaped correctly instead of breaking the JSON string. # Bitrise → Code Signing tab BEFORE running this workflow
export APIKEY_PATH="$BITRISE_SOURCE_DIR/Darwin/fastlane/apikey.json" - xcode-archive@5:
ruby -rjson -e '
File.write(ENV["APIKEY_PATH"], JSON.generate({
"key_id" => ENV["ASC_KEY_ID"],
"issuer_id" => ENV["ASC_ISSUER_ID"],
"key" => ENV["ASC_KEY_CONTENT"],
"in_house" => false
}))
'
- fastlane@3:
inputs: inputs:
- lane: beta - project_path: $BITRISE_PROJECT_PATH
- work_dir: $BITRISE_SOURCE_DIR/Darwin - scheme: $BITRISE_SCHEME
- distribution_method: $BITRISE_DISTRIBUTION_METHOD
- automatic_code_signing: api-key
- register_test_devices: "no"
- deploy-to-itunesconnect-deliver@2:
inputs:
- itunescon_user: $APPLE_ID
- api_key_path: ""
- api_issuer: $ASC_ISSUER_ID
- submit_for_review: "no"
- skip_metadata: "yes"
- skip_screenshots: "yes"
# ── Full release → App Store ─────────────────────────────────────────────── # ── Full release → App Store ───────────────────────────────────────────────
release: release:
description: Build, sign, and upload to App Store description: Build, sign, push metadata+screenshots, upload binary to App Store
envs:
- ASC_KEY_ID: $ASC_KEY_ID
- ASC_ISSUER_ID: $ASC_ISSUER_ID
- ASC_KEY_CONTENT: $ASC_KEY_CONTENT
- ITC_TEAM_ID: $ITC_TEAM_ID
steps: steps:
- git-clone@8: {} - git-clone@8: {}
- script@1: - script@1:
title: Verify secrets title: Verify ASC secrets
inputs: inputs:
- content: | - content: |
if [ -z "$ASC_KEY_ID" ] || [ -z "$DEVELOPMENT_TEAM" ]; then if [ -z "$ASC_KEY_ID" ]; then
echo "ERROR: ASC_KEY_ID / ASC_ISSUER_ID / ASC_KEY_CONTENT / DEVELOPMENT_TEAM must be set in Bitrise Secrets" echo "ERROR: ASC_KEY_ID is empty"
exit 1 exit 1
fi fi
echo "ASC_KEY_ID is set (length: ${#ASC_KEY_ID})" echo "ASC_KEY_ID is set (length: ${#ASC_KEY_ID})"
echo "DEVELOPMENT_TEAM is set (length: ${#DEVELOPMENT_TEAM})" echo "ASC_ISSUER_ID is set (length: ${#ASC_ISSUER_ID})"
echo "ASC_KEY_CONTENT is set (length: ${#ASC_KEY_CONTENT})"
- script@1: - script@1:
title: Set build number title: Set build number
inputs: inputs:
- content: | - content: |
cd $BITRISE_SOURCE_DIR cd $BITRISE_SOURCE_DIR
sed -i '' "s/CURRENT_PROJECT_VERSION = .*/CURRENT_PROJECT_VERSION = $BITRISE_BUILD_NUMBER/" Skip.env agvtool new-version -all $BITRISE_BUILD_NUMBER
- script@1: - manage-ios-code-signing@2:
title: Write code signing team and App Store Connect API key
inputs: inputs:
- content: | - distribution_method: app-store
echo "DEVELOPMENT_TEAM = $DEVELOPMENT_TEAM" >> "$BITRISE_SOURCE_DIR/Darwin/fastlane/AppStore.xcconfig" - project_path: $BITRISE_PROJECT_PATH
# ASC_KEY_CONTENT is the raw multi-line .p8 PEM content — build - scheme: $BITRISE_SCHEME
# the JSON with Ruby's encoder so its embedded newlines get - xcode-archive@5:
# escaped correctly instead of breaking the JSON string. inputs:
export APIKEY_PATH="$BITRISE_SOURCE_DIR/Darwin/fastlane/apikey.json" - project_path: $BITRISE_PROJECT_PATH
ruby -rjson -e ' - scheme: $BITRISE_SCHEME
File.write(ENV["APIKEY_PATH"], JSON.generate({ - distribution_method: $BITRISE_DISTRIBUTION_METHOD
"key_id" => ENV["ASC_KEY_ID"], - automatic_code_signing: api-key
"issuer_id" => ENV["ASC_ISSUER_ID"],
"key" => ENV["ASC_KEY_CONTENT"],
"in_house" => false
}))
'
- fastlane@3: - fastlane@3:
inputs: inputs:
- lane: release - lane: release
- work_dir: $BITRISE_SOURCE_DIR/Darwin - work_dir: $BITRISE_SOURCE_DIR
- deploy-to-bitrise-io@2: {} - deploy-to-bitrise-io@2: {}
# ─── TRIGGER MAP ──────────────────────────────────────────────────────────────── # ─── TRIGGER MAP ──────────────────────────────────────────────────────────────
trigger_map: trigger_map:
- push_branch: develop - push_branch: develop
workflow: beta workflow: beta
- push_branch: main - push_branch: main
workflow: release workflow: release
- pull_request_source_branch: feature/*
workflow: test