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 }} new_build_number: ${{ steps.generate_build_number.outputs.build_number }}
project_version: ${{ steps.determine_marketing_version.outputs.project_version }} project_version: ${{ steps.determine_marketing_version.outputs.project_version }}
ipa_output_path: ${{ steps.build_app.outputs.ipa_output_path }} 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: env:
APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_ID: ${{ secrets.APPLE_ID }}
steps: steps:
- name: Checkout Project - name: Checkout Project
uses: actions/checkout@v4 uses: actions/checkout@v4
with: 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 - name: Specify Node.js Version
uses: actions/setup-node@v4 uses: actions/setup-node@v4
@ -54,13 +82,6 @@ jobs:
run: | run: |
bundle exec fastlane ios install_pods 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 - name: Generate Build Number Based on Timestamp
id: generate_build_number id: generate_build_number
run: | run: |
@ -121,7 +142,7 @@ jobs:
with: with:
name: BlueWallet_${{env.PROJECT_VERSION}}_${{env.NEW_BUILD_NUMBER}}.ipa name: BlueWallet_${{env.PROJECT_VERSION}}_${{env.NEW_BUILD_NUMBER}}.ipa
path: ${{ env.IPA_OUTPUT_PATH }} # Directly from Fastfile `IPA_OUTPUT_PATH` path: ${{ env.IPA_OUTPUT_PATH }} # Directly from Fastfile `IPA_OUTPUT_PATH`
testflight-upload: testflight-upload:
needs: build needs: build
runs-on: macos-latest runs-on: macos-latest
@ -131,6 +152,7 @@ jobs:
NEW_BUILD_NUMBER: ${{ needs.build.outputs.new_build_number }} NEW_BUILD_NUMBER: ${{ needs.build.outputs.new_build_number }}
PROJECT_VERSION: ${{ needs.build.outputs.project_version }} PROJECT_VERSION: ${{ needs.build.outputs.project_version }}
LATEST_COMMIT_MESSAGE: ${{ needs.build.outputs.latest_commit_message }} LATEST_COMMIT_MESSAGE: ${{ needs.build.outputs.latest_commit_message }}
BRANCH_NAME: ${{ needs.build.outputs.branch_name }}
steps: steps:
- name: Checkout Project - name: Checkout Project
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -158,7 +180,7 @@ jobs:
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: BlueWallet_${{ needs.build.outputs.project_version }}_${{ needs.build.outputs.new_build_number }}.ipa 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 - name: Create App Store Connect API Key JSON
run: echo '${{ secrets.APP_STORE_CONNECT_API_KEY_CONTENT }}' > ./appstore_api_key.json run: echo '${{ secrets.APP_STORE_CONNECT_API_KEY_CONTENT }}' > ./appstore_api_key.json
@ -169,7 +191,7 @@ jobs:
pwd pwd
echo "Files in current directory:" echo "Files in current directory:"
ls -la ./ ls -la ./
- name: Set IPA Path Environment Variable - name: Set IPA Path Environment Variable
run: echo "IPA_OUTPUT_PATH=$(pwd)/BlueWallet_${{ needs.build.outputs.project_version }}_${{ needs.build.outputs.new_build_number }}.ipa" >> $GITHUB_ENV run: echo "IPA_OUTPUT_PATH=$(pwd)/BlueWallet_${{ needs.build.outputs.project_version }}_${{ needs.build.outputs.new_build_number }}.ipa" >> $GITHUB_ENV
@ -180,6 +202,11 @@ jobs:
exit 1 exit 1
fi fi
- name: Print Environment Variables for Debugging
run: |
echo "LATEST_COMMIT_MESSAGE: $LATEST_COMMIT_MESSAGE"
echo "BRANCH_NAME: $BRANCH_NAME"
- name: Upload to TestFlight - name: Upload to TestFlight
run: | run: |
ls -la $IPA_OUTPUT_PATH ls -la $IPA_OUTPUT_PATH

View File

@ -293,22 +293,34 @@ platform :ios do
cocoapods(podfile: "ios/Podfile") cocoapods(podfile: "ios/Podfile")
end 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 desc "Upload IPA to TestFlight"
lane :upload_to_testflight_lane do
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) if ipa_path.nil? || ipa_path.empty? || !File.exist?(ipa_path)
UI.user_error!("IPA file not found at path: #{ipa_path}") UI.user_error!("IPA file not found at path: #{ipa_path}")
end end
UI.message("Uploading IPA to TestFlight from path: #{ipa_path}") UI.message("Uploading IPA to TestFlight from path: #{ipa_path}")
UI.message("Changelog:\n#{changelog}")
upload_to_testflight( upload_to_testflight(
api_key_path: "./appstore_api_key.json", api_key_path: "./appstore_api_key.json",
ipa: ipa_path, ipa: ipa_path,
skip_waiting_for_build_processing: true, # Do not wait for processing skip_waiting_for_build_processing: true,
changelog: changelog changelog: changelog
) )