Skip to content

feat: create bitrise step#13

Open
bacarybruno wants to merge 10 commits into
callstackincubator:mainfrom
bacarybruno:bitrise-step
Open

feat: create bitrise step#13
bacarybruno wants to merge 10 commits into
callstackincubator:mainfrom
bacarybruno:bitrise-step

Conversation

@bacarybruno

@bacarybruno bacarybruno commented Sep 8, 2025

Copy link
Copy Markdown

Context: callstackincubator/rock#552

This PR adds the initial version of the Rock Bitrise workflow.
It is largely based on the existing GitHub Actions workflow, which also served as the reference for the step.sh script.

At this stage, step.sh duplicates some of the logic defined in action.yml.
In future iterations, we can consider extracting the common functionality into a shared script or library so that both Bitrise and GitHub workflows can consume the same code and stay in sync.

Documentation will follow once we align on this PR.

@thymikee

thymikee commented Sep 9, 2025

Copy link
Copy Markdown
Member

Looks good! How can we test this? Do you have a sample repo you could share?

@bacarybruno

Copy link
Copy Markdown
Author

I tested it manually by creating a new rock project, but I can prepare a sample repo yes 👍

@bacarybruno

Copy link
Copy Markdown
Author

Hello again!

I tested using this workflow file: bitrise.yml.

Screenshot 2025-09-09 at 20 20 32

It works, but I had to create a dedicated repository to host the Bitrise workflow: bitrise-rock-remote-build-ios, since Bitrise requires the step.yml file to be at the repository root.

So now we have two possible approaches:
1️⃣ Move step.yml and step.sh to the root of the current repo.
2️⃣ Keep a dedicated repo just for the Bitrise workflow.

Which option do you think we should go with? Or do you see another possible solution?

@thymikee

Copy link
Copy Markdown
Member

If possible, I'd keep the code colocated. Especially if we could reuse some of these shell scripts

@thymikee

Copy link
Copy Markdown
Member

I've invited you to our internal repo for testing Rock's remote builds: https://github.com/callstack-internal/rock-remote-build-test/. I think we should make it public soon, and it could be our test bed for CI workflows we support

@bacarybruno

bacarybruno commented Sep 10, 2025

Copy link
Copy Markdown
Author

If possible, I'd keep the code colocated. Especially if we could reuse some of these shell scripts

Good point, I updated the PR to move the bitrise step to the repository root + tested the workflow on rock-remote-build-test.

@bacarybruno

Copy link
Copy Markdown
Author

Hello @thymikee the PR is ready as I just updated the readme. Please don't hesitate to ping me if you think there is still something missing.
After this PR I'll do the same for Android, then maybe the website will also need to be updated.

@bacarybruno

Copy link
Copy Markdown
Author

fyi in a follow-up PR, I plan to introduce a Bitrise remote cache provider that handles saving and restoring the .rock folder. The main limitation is retrieval in local environments: it’s possible to fetch cache items through the Bitrise API but there’s no server-side filtering. We would need to paginate through the available entries and filter them client-side until the right one is found. https://docs.bitrise.io/en/bitrise-ci/api/api-reference.html#operations-tag-key-value-cache

And also we can't upload programmatically. For that maybe I can do something like this :

ios/action.yml

Line 308 in 08a533d

if: ${{ env.PROVIDER_NAME == 'GitHub' && (!env.ARTIFACT_URL || (inputs.re-sign == 'true' && github.event_name == 'pull_request')) }}

@thymikee

Copy link
Copy Markdown
Member

We would need to paginate through the available entries and filter them client-side until the right one is found. https://docs.bitrise.io/en/bitrise-ci/api/api-reference.html#operations-tag-key-value-cache

This is fine, if there's no other way, should still be pretty fast to retrieve available artifacts

And also we can't upload programmatically. For that maybe I can do something like this

Makes sense, if there's no other API (same for GitHub)

Comment thread step.sh Outdated
ARTIFACT_TRAITS="${DESTINATION},${CONFIGURATION},${BITRISE_PULL_REQUEST:-}"
envman add --key ARTIFACT_TRAITS --value "$ARTIFACT_TRAITS"

OUTPUT="$(npx rock remote-cache list -p ios --traits "${ARTIFACT_TRAITS}" --json || true)"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about the || true part. The reason we do || (echo "$OUTPUT" && exit 1) is for escaped shell commands, such as ${npx rock remote-cache ...) here to show error output when they fail and exit

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here 374ceb8

Comment thread step.sh Outdated
Comment on lines +113 to +131
KEYCHAIN_PATH="$RUNNER_TEMP/app-signing.keychain-db"

security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security set-keychain-settings -lut 21600 "$KEYCHAIN_PATH"
security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"

CERTIFICATE_PATH="$RUNNER_TEMP/certificate.p12"
echo -n "$CERTIFICATE_BASE64" | base64 --decode -o "$CERTIFICATE_PATH"
security import "$CERTIFICATE_PATH" -P "$CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k "$KEYCHAIN_PATH"
security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN_PATH"
security list-keychain -d user -s "$KEYCHAIN_PATH"

IDENTITY="$(security find-identity -v -p codesigning "$KEYCHAIN_PATH" | grep -oE '([0-9A-F]{40})' | head -n 1 || true)"
echo "Certificate identity: $IDENTITY"
envman add --key IDENTITY --value "$IDENTITY"

mkdir -p "$PROFILE_DIR"
PROFILE_PATH="$PROFILE_DIR/$PROVISIONING_PROFILE_NAME.mobileprovision"
echo -n "$PROVISIONING_PROFILE_BASE64" | base64 --decode -o "$PROFILE_PATH"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this the recommended way to process provisioning profiles on Bitrise? we followed the recommendation for GitHub, but just want to make sure this is ok

@bacarybruno bacarybruno Sep 14, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many ways to handle this. Some projects like ours use Fastlane, others rely on one of the recommended options, or even custom setups etc. I’m wondering if we should let each project manage its own signature setup, and simply pass the --identity flag value to the workflow instead.

What do you think about it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would look like this b578ca1

@bacarybruno bacarybruno Sep 17, 2025

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and completed here 6db3bdd

@thymikee thymikee left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good already, just small nits 👍🏼

Comment thread step.sh Outdated
ARTIFACT_TRAITS="${DESTINATION},${CONFIGURATION},${BITRISE_PULL_REQUEST:-}"
envman add --key ARTIFACT_TRAITS --value "$ARTIFACT_TRAITS"

OUTPUT="$(npx rock remote-cache list -p ios --traits "${ARTIFACT_TRAITS}" --json || (echo "$OUTPUT" && exit 1))"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OUTPUT needs to evaluate, so we can't wrap everything with " quotes. In GHAction we're using this syntax, I think it should work:

Suggested change
OUTPUT="$(npx rock remote-cache list -p ios --traits "${ARTIFACT_TRAITS}" --json || (echo "$OUTPUT" && exit 1))"
OUTPUT=$(npx rock remote-cache list -p ios --traits "${ARTIFACT_TRAITS}" --json || (echo "$OUTPUT" && exit 1))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right, thanks I'll update

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated here 395dd01

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @thymikee sorry for the ping. Is there something additional that needs to be done on this PR? 🙏

@ajanuar

ajanuar commented Sep 24, 2025

Copy link
Copy Markdown

Hi @bacarybruno , Thanks for this PR 🙌 As a Bitrise user, I’m happy to see this coming in. I’m willing to give it a test on my setup and share feedback.

@bacarybruno

Copy link
Copy Markdown
Author

Yes @ajanuar that would be really helpful 🙏

@thymikee

Copy link
Copy Markdown
Member

FYI, we've added support for provisioning profile and certificates as files: #14

@bacarybruno

Copy link
Copy Markdown
Author

Supporting them will depend on #13 (comment). Do you think we should support them in this workflow?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants