Merge pull request 'fix/ci/apikey-json-escaping' (#16) from fix/ci/apikey-json-escaping into main

Reviewed-on: Loverde-Company-LTDA/Pedi-Foods-Skip#16
This commit is contained in:
2026-07-09 17:24:29 -03:00
2 changed files with 104 additions and 36 deletions

View File

@@ -20,26 +20,35 @@ lane :assemble do |options|
) )
end end
# ─── Upload IPA to TestFlight (Bitrise's xcode-archive step already built it) ──
lane :beta do |options| lane :beta do |options|
desc "Build and upload to TestFlight"
get_provisioning_profile(api_key_path: "fastlane/apikey.json")
assemble
upload_to_testflight( upload_to_testflight(
ipa: ENV["BITRISE_IPA_PATH"], api_key_path: "fastlane/apikey.json",
skip_waiting_for_build_processing: true skip_waiting_for_build_processing: true
) )
end end
# ─── Push metadata + upload IPA to App Store (Bitrise already built it) ───────
lane :release do |options| lane :release do |options|
deliver( desc "Build and release app"
ipa: ENV["BITRISE_IPA_PATH"],
# see https://docs.fastlane.tools/uploading-app-privacy-details/
#upload_app_privacy_details_to_app_store(json_path: "fastlane/app_privacy_details.json")
# if you have an apikey.json file (https://developer.apple.com/documentation/appstoreconnectapi/creating-api-keys-for-app-store-connect-api), fastlane can automatically fetch certificates and the ASC authentication information
#get_certificates(api_key_path: "fastlane/apikey.json")
get_provisioning_profile(api_key_path: "fastlane/apikey.json")
assemble
upload_to_app_store(
api_key_path: "fastlane/apikey.json",
app_rating_config_path: "fastlane/metadata/rating.json", app_rating_config_path: "fastlane/metadata/rating.json",
release_notes: { default: "Fixes and improvements." }, release_notes: { default: "Fixes and improvements." }
skip_screenshots: false,
skip_metadata: false,
force: true,
submit_for_review: false,
automatic_release: false,
run_precheck_before_submit: false
) )
end end

View File

@@ -9,7 +9,8 @@ meta:
app: app:
envs: envs:
- BITRISE_PROJECT_PATH: Darwin/PediFoods.xcodeproj - TEST_SHARD_COUNT: 2
- BITRISE_PROJECT_PATH: PediFoods.xcodeproj
opts: opts:
is_expand: false is_expand: false
- BITRISE_SCHEME: PediFoods App - BITRISE_SCHEME: PediFoods App
@@ -24,16 +25,75 @@ app:
# ASC_ISSUER_ID → App Store Connect Issuer ID # ASC_ISSUER_ID → App Store Connect Issuer ID
# ASC_KEY_CONTENT → .p8 file content base64-encoded # ASC_KEY_CONTENT → .p8 file content base64-encoded
# ITC_TEAM_ID → iTunes Connect Team ID (numeric) # ITC_TEAM_ID → iTunes Connect Team ID (numeric)
# DEVELOPMENT_TEAM → Apple Developer Team ID, written into
# Darwin/fastlane/AppStore.xcconfig at build time # ─── PIPELINES ────────────────────────────────────────────────────────────────
# (Darwin/PediFoods.xcconfig leaves it blank on pipelines:
# purpose — this project has no VERSIONING_SYSTEM / run_tests:
# hardcoded team like LC Wallet, so it's injected workflows:
# here instead) build_for_testing: {}
test_without_building:
depends_on:
- build_for_testing
parallel: "$TEST_SHARD_COUNT"
# ─── 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
@@ -44,16 +104,14 @@ 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:
# No VERSIONING_SYSTEM is set on the target, so agvtool
# (which LC Wallet uses) does not apply to this project.
sed -i '' "s/CURRENT_PROJECT_VERSION = .*/CURRENT_PROJECT_VERSION = $BITRISE_BUILD_NUMBER/" Skip.env
- script@1:
title: Write code signing team
inputs: inputs:
- content: | - distribution_method: app-store
echo "DEVELOPMENT_TEAM = $DEVELOPMENT_TEAM" >> "$BITRISE_SOURCE_DIR/Darwin/fastlane/AppStore.xcconfig" - project_path: $BITRISE_PROJECT_PATH
- scheme: $BITRISE_SCHEME
# MANUAL: Upload .p12 cert + .mobileprovision in
# Bitrise → Code Signing tab BEFORE running this workflow
- xcode-archive@5: - xcode-archive@5:
inputs: inputs:
- project_path: $BITRISE_PROJECT_PATH - project_path: $BITRISE_PROJECT_PATH
@@ -72,7 +130,7 @@ workflows:
# ── Full release → App Store ─────────────────────────────────────────────── # ── Full release → App Store ───────────────────────────────────────────────
release: release:
description: Build, sign, push metadata, upload binary to App Store description: Build, sign, push metadata+screenshots, upload binary to App Store
envs: envs:
- ASC_KEY_ID: $ASC_KEY_ID - ASC_KEY_ID: $ASC_KEY_ID
- ASC_ISSUER_ID: $ASC_ISSUER_ID - ASC_ISSUER_ID: $ASC_ISSUER_ID
@@ -91,18 +149,17 @@ workflows:
echo "ASC_KEY_ID is set (length: ${#ASC_KEY_ID})" echo "ASC_KEY_ID is set (length: ${#ASC_KEY_ID})"
echo "ASC_ISSUER_ID is set (length: ${#ASC_ISSUER_ID})" echo "ASC_ISSUER_ID is set (length: ${#ASC_ISSUER_ID})"
echo "ASC_KEY_CONTENT is set (length: ${#ASC_KEY_CONTENT})" echo "ASC_KEY_CONTENT is set (length: ${#ASC_KEY_CONTENT})"
echo "DEVELOPMENT_TEAM is set (length: ${#DEVELOPMENT_TEAM})"
- 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
inputs: inputs:
- content: | - distribution_method: app-store
echo "DEVELOPMENT_TEAM = $DEVELOPMENT_TEAM" >> "$BITRISE_SOURCE_DIR/Darwin/fastlane/AppStore.xcconfig" - project_path: $BITRISE_PROJECT_PATH
- scheme: $BITRISE_SCHEME
- xcode-archive@5: - xcode-archive@5:
inputs: inputs:
- project_path: $BITRISE_PROJECT_PATH - project_path: $BITRISE_PROJECT_PATH
@@ -112,7 +169,7 @@ workflows:
- 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 ──────────────────────────────────────────────────────────────
@@ -121,3 +178,5 @@ trigger_map:
workflow: beta workflow: beta
- push_branch: main - push_branch: main
workflow: release workflow: release
- pull_request_source_branch: feature/*
workflow: test