Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: ensure task fails if any build fails #166

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/build-sample-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ jobs:
uses: customerio/customerio-android/.github/actions/setup-android@main

- name: Build and upload Android app via Fastlane
id: android_build
uses: maierj/[email protected]
with:
subdirectory: apps/${{ matrix.sample-app }}
Expand All @@ -157,6 +158,7 @@ jobs:
run: pod install --project-directory=ios

- name: Build and upload iOS app via Fastlane
id: ios_build
uses: maierj/[email protected]
with:
subdirectory: apps/${{ matrix.sample-app }}
Expand All @@ -165,6 +167,13 @@ jobs:
GOOGLE_CLOUD_MATCH_READONLY_SERVICE_ACCOUNT_B64: ${{ secrets.GOOGLE_CLOUD_MATCH_READONLY_SERVICE_ACCOUNT_B64 }}
FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64: ${{ secrets.FIREBASE_APP_DISTRIBUTION_SERVICE_ACCOUNT_CREDS_B64 }}

- name: Check build statuses and mark failure
run: |
if [ "${{ steps.android_build.outcome }}" != "success" ] || [ "${{ steps.ios_build.outcome }}" != "success" ]; then
echo "One or more builds failed."
exit 1
fi

- name: Update sample builds PR comment with build information
if: ${{ github.event_name == 'pull_request' }}
uses: peter-evans/create-or-update-comment@v4
Expand Down
22 changes: 19 additions & 3 deletions apps/fastlane/helpers/version_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,30 @@

# Replace '/' with '-' to avoid issues with unsupported characters in version name
branch_name = branch_name.gsub('/', '-')
timestamp = current_time.strftime("%Y%m%d.%H%M%S")
# Extract ticket number from branch name
ticket_number_in_branch_name = branch_name.scan(/\d+/).join
# If no ticket number found, set it to 0
ticket_number_in_branch_name = ticket_number_in_branch_name.empty? ? "0" : ticket_number_in_branch_name

sdk_version_name = "#{timestamp}.0-#{branch_name}"
# Format the components individually and remove leading zeros
year = current_time.year.to_s
month = current_time.month.to_s
day = current_time.day.to_s
hour = current_time.hour.to_s
minute = current_time.min.to_s
second = current_time.sec.to_s

# Combine them into the desired format
major = "#{year}#{month}#{day}"
minor = "#{hour}#{minute}#{second}"
patch = ticket_number_in_branch_name.to_s

sdk_version_name = "#{major}.#{minor}.#{patch}"
mrehan27 marked this conversation as resolved.
Show resolved Hide resolved

if github.is_pull_request
app_version_name = "#{github.pr_number}.#{github.pr_commits}.0"
else
app_version_name = sdk_version_name
app_version_name = "#{sdk_version_name}-#{branch_name}"
end
app_version_code = (current_time.to_f / 60).to_i

Expand Down
Loading