Update Fastfile (#7260)

This commit is contained in:
Marcos Rodriguez Vélez 2024-11-05 15:01:49 -04:00 committed by GitHub
parent 728926589a
commit 43eeff29e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 57 additions and 18 deletions

View File

@ -18,14 +18,42 @@ jobs:
new_build_number: ${{ steps.generate_build_number.outputs.build_number }}
project_version: ${{ steps.determine_marketing_version.outputs.project_version }}
ipa_output_path: ${{ steps.build_app.outputs.ipa_output_path }}
latest_commit_message: ${{ steps.get_latest_commit_message.outputs.commit_message }}
latest_commit_message: ${{ steps.get_latest_commit_details.outputs.commit_message }}
branch_name: ${{ steps.get_latest_commit_details.outputs.branch_name }}
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
steps:
- name: Checkout Project
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetches all history
fetch-depth: 0 # Ensures the full Git history is available
- name: Ensure Correct Branch
run: |
if [ -n "${GITHUB_HEAD_REF}" ]; then
git fetch origin ${GITHUB_HEAD_REF}:${GITHUB_HEAD_REF}
git checkout ${GITHUB_HEAD_REF}
else
git fetch origin ${GITHUB_REF##*/}:${GITHUB_REF##*/}
git checkout ${GITHUB_REF##*/}
fi
echo "Checked out branch: $(git rev-parse --abbrev-ref HEAD)"
- name: Get Latest Commit Details
id: get_latest_commit_details
run: |
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
LATEST_COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")
echo "CURRENT_BRANCH=${CURRENT_BRANCH}" >> $GITHUB_ENV
echo "LATEST_COMMIT_MESSAGE=${LATEST_COMMIT_MESSAGE}" >> $GITHUB_ENV
echo "branch_name=${CURRENT_BRANCH}" >> $GITHUB_OUTPUT
echo "commit_message=${LATEST_COMMIT_MESSAGE}" >> $GITHUB_OUTPUT
- name: Print Commit Details
run: |
echo "Commit Message: ${{ env.LATEST_COMMIT_MESSAGE }}"
echo "Branch Name: ${{ env.CURRENT_BRANCH }}"
- name: Specify Node.js Version
uses: actions/setup-node@v4
@ -54,13 +82,6 @@ jobs:
run: |
bundle exec fastlane ios install_pods
- name: Get Latest Commit Message
id: get_latest_commit_message
run: |
LATEST_COMMIT_MESSAGE=$(git log -1 --pretty=format:"%s")
echo "LATEST_COMMIT_MESSAGE=${LATEST_COMMIT_MESSAGE}" >> $GITHUB_ENV
echo "commit_message=$LATEST_COMMIT_MESSAGE" >> $GITHUB_OUTPUT
- name: Generate Build Number Based on Timestamp
id: generate_build_number
run: |
@ -131,6 +152,7 @@ jobs:
NEW_BUILD_NUMBER: ${{ needs.build.outputs.new_build_number }}
PROJECT_VERSION: ${{ needs.build.outputs.project_version }}
LATEST_COMMIT_MESSAGE: ${{ needs.build.outputs.latest_commit_message }}
BRANCH_NAME: ${{ needs.build.outputs.branch_name }}
steps:
- name: Checkout Project
uses: actions/checkout@v4
@ -158,7 +180,7 @@ jobs:
uses: actions/download-artifact@v4
with:
name: BlueWallet_${{ needs.build.outputs.project_version }}_${{ needs.build.outputs.new_build_number }}.ipa
path: ./ # Download the IPA file to the current working directory
path: ./
- name: Create App Store Connect API Key JSON
run: echo '${{ secrets.APP_STORE_CONNECT_API_KEY_CONTENT }}' > ./appstore_api_key.json
@ -180,6 +202,11 @@ jobs:
exit 1
fi
- name: Print Environment Variables for Debugging
run: |
echo "LATEST_COMMIT_MESSAGE: $LATEST_COMMIT_MESSAGE"
echo "BRANCH_NAME: $BRANCH_NAME"
- name: Upload to TestFlight
run: |
ls -la $IPA_OUTPUT_PATH

View File

@ -293,22 +293,34 @@ platform :ios do
cocoapods(podfile: "ios/Podfile")
end
desc "Upload IPA to TestFlight"
lane :upload_to_testflight_lane do
ipa_path = ENV['IPA_OUTPUT_PATH']
changelog = ENV["LATEST_COMMIT_MESSAGE"]
# Check if IPA exists before proceeding
branch_name = ENV['BRANCH_NAME'] || "unknown-branch"
last_commit_message = ENV['LATEST_COMMIT_MESSAGE'] || "No commit message found"
changelog = <<~CHANGELOG
Build Information:
- Branch: #{branch_name}
- Commit Message: #{last_commit_message}
CHANGELOG
ipa_path = ENV['IPA_OUTPUT_PATH']
if ipa_path.nil? || ipa_path.empty? || !File.exist?(ipa_path)
UI.user_error!("IPA file not found at path: #{ipa_path}")
end
UI.message("Uploading IPA to TestFlight from path: #{ipa_path}")
UI.message("Changelog:\n#{changelog}")
upload_to_testflight(
api_key_path: "./appstore_api_key.json",
ipa: ipa_path,
skip_waiting_for_build_processing: true, # Do not wait for processing
skip_waiting_for_build_processing: true,
changelog: changelog
)