Skip to content

Commit

Permalink
Update docs with Info.plist Xcode setting (#32)
Browse files Browse the repository at this point in the history
* Update docs with Info.plist Xcode setting

* Delete backup
  • Loading branch information
ofalvai authored Nov 21, 2023
1 parent 1ca0d29 commit f0272f2
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 56 deletions.
122 changes: 71 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,53 +1,73 @@
# Set Xcode Project Build Number

Sets the Build Number (bundle version) to the specified value,
in the target `Info.plist` file for the next build.

## Inputs

- plist_path: "" __(required)__
> Path to the given target's Info.plist file. You need to use this step for each archivable target of your project.
- build_version: "$BITRISE_BUILD_NUMBER" __(required)__
> Set the CFBundleVersion to this value.
- build_version_offset: ""
> This offset will be added to `build_version` input's value.
- build_short_version_string: ""
> Set the CFBundleShortVersionString to this value.
## Outputs

### Exported Environment variables

- XCODE_BUNDLE_VERSION: The bundle version used in the Info.plist file

## Contribute

1. Fork this repository
1. Make changes
1. Submit a PR

## How to run this step from source

1. Clone this repository
1. `cd` to the cloned repository's root
1. Create a bitrise.yml (if not yet created)
1. Prepare a workflow that contains a step with the id: `path::./`
> For example:
> ```yaml
> format_version: "6"
> default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
>
> workflows:
> my-workflow:
> steps:
> - path::./:
> inputs:
> - my_input: "my input value"
> ```
1. Run the workflow: `bitrise run my-workflow`
## About
This is an official Step managed by Bitrise.io and is available in the [Workflow Editor](https://www.bitrise.io/features/workflow-editor) and in our [Bitrise CLI](https://github.com/bitrise-io/bitrise) tool. If you seen something in this readme that never before please visit some of our knowledge base to read more about that:
- devcenter.bitrise.io
- discuss.bitrise.io
- blog.bitrise.io
[![Step changelog](https://shields.io/github/v/release/bitrise-io/set-xcode-build-number?include_prereleases&label=changelog&color=blueviolet)](https://github.com/bitrise-io/set-xcode-build-number/releases)

Set the value of your iOS app's bundle version in the `Info.plist` file to the specified version number.

<details>
<summary>Description</summary>

Set the value of your iOS app's bundle version in the `Info.plist` file to the specified version number. A great
way to keep track of versions when submitting bug reports.

If your IPA contains multiple build targets, they need to have the same version number as your app's main target has.
In that case, you need to add this Step to your Workflow for each build target: if you have, say, three targets, you need to have three instances of this Step in your Workflow.
If there are targets with different version numbers the app cannot be submitted for App Review or Beta App Review.

### Configuring the Step

1. In your Xcode project, set the Generate Info.plist File to No, under PROJECT and TARGETS on the Build Settings tab.
1. Manually create the `Info.plist` file and check it into source control. Make sure you have all the necessary keys defined in the file.
1. Configure this step by pointing the **Info.plist file path** input to the `Info.plist` file in the source repo.
1. Add a value in the Build Number input.
This sets the CFBundleVersion key to the specified value in the `Info.plist` file. The default value is the `$BITRISE_BUILD_NUMBER` Environment Variable.
1. Optionally, add a value in the Version Number input. This will set the `CFBundleShortVersionString` key to the specified value in the `Info.plist` file. This input is not required.

### Useful links

- [Build numbering and app versioning](https://devcenter.bitrise.io/builds/build-numbering-and-app-versioning/#setting-the-cfbundleversion-and-cfbundleshortversionstring-of-an-ios-app)
- [CFBundleversion in Apple documentation](https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundleversion)

### Related Steps

- [Xcode Archive & Export for iOS](https://www.bitrise.io/integrations/steps/xcode-archive)
- [Set Android Manifest Version Code and Name](https://www.bitrise.io/integrations/steps/set-android-manifest-versions)
</details>

## 🧩 Get started

Add this step directly to your workflow in the [Bitrise Workflow Editor](https://devcenter.bitrise.io/steps-and-workflows/steps-and-workflows-index/).

You can also run this step directly with [Bitrise CLI](https://github.com/bitrise-io/bitrise).

## ⚙️ Configuration

<details>
<summary>Inputs</summary>

| Key | Description | Flags | Default |
| --- | --- | --- | --- |
| `plist_path` | Path to the given target's Info.plist file. You need to use this Step for each archivable target of your project. **NOTE:**<br/> If your IPA contains multiple build targets, they would need to have the same version number as your app's main target has.<br/> You need to add this Step to your Workflow for each build target: if you have, say, three targets, you need to have three instances of this Step in your Workflow. If there are targets with different version numbers the app cannot be submitted for App Review or Beta App Review. | required | |
| `build_version` | Set the CFBundleVersion to this value. You can find this in Xcode: - Select your project in the **Project navigator** - Go to the **General** tab and then the **Identity** section - **Build field** | required | `$BITRISE_BUILD_NUMBER` |
| `build_version_offset` | This offset will be added to `build_version` input's value. | | |
| `build_short_version_string` | Set the CFBundleShortVersionString to this value. You can find this in Xcode: - Select your project in the **Project navigator** - Go to the **General** tab and then the **Identity** section - **Version field** | | |
</details>

<details>
<summary>Outputs</summary>

| Environment Variable | Description |
| --- | --- |
| `XCODE_BUNDLE_VERSION` | The bundle version used in the Info.plist file |
</details>

## 🙋 Contributing

We welcome [pull requests](https://github.com/bitrise-io/set-xcode-build-number/pulls) and [issues](https://github.com/bitrise-io/set-xcode-build-number/issues) against this repository.

For pull requests, work on your changes in a forked repository and use the Bitrise CLI to [run step tests locally](https://devcenter.bitrise.io/bitrise-cli/run-your-first-build/).

Learn more about developing steps:

- [Create your own step](https://devcenter.bitrise.io/contributors/create-your-own-step/)
- [Testing your Step](https://devcenter.bitrise.io/contributors/testing-and-versioning-your-steps/)
9 changes: 6 additions & 3 deletions bitrise.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
format_version: 7
format_version: "12"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

app:
Expand Down Expand Up @@ -29,7 +29,6 @@ workflows:
To prevent step testing issues, like referencing relative
files with just './some-file', which would work for local tests
but not if the step is included in another bitrise.yml!
run_if: true
inputs:
- path: ./_tmp
- is_create_path: true
Expand All @@ -42,7 +41,6 @@ workflows:
git clone $SAMPLE_APP_REPOSITORY_URL $SAMPLE_APP_CLONE_INTO_DIR
- path::./:
run_if: true
inputs:
- plist_path: ${MY_PLIST_PATH}
- build_short_version_string: "1"
Expand All @@ -62,6 +60,11 @@ workflows:
echo $XCODE_BUNDLE_VERSION
generate-readme:
steps:
- git::https://github.com/bitrise-steplib/steps-readme-generator.git@main: { }


# ----------------------------------------------------------------
# --- workflow to Share this step into a Step Library
audit-this-step:
Expand Down
9 changes: 7 additions & 2 deletions step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ description: |-
### Configuring the Step
1. Set the file path to the `Info.plist` file in the `Info.plist` file path input.
1. In your Xcode project, set the Generate Info.plist File to No, under PROJECT and TARGETS on the Build Settings tab.
1. Manually create the `Info.plist` file and check it into source control. Make sure you have all the necessary keys defined in the file.
1. Configure this step by pointing the **Info.plist file path** input to the `Info.plist` file in the source repo.
1. Add a value in the Build Number input.
This sets the CFBundleVersion key to the specified value in the `Info.plist` file. The default value is the `$BITRISE_BUILD_NUMBER` Environment Variable.
1. Optionally, add a value in the Version Number input. This will set the `CFBundleShortVersionString` key to the specified value in the `Info.plist` file. This input is not required.
Expand Down Expand Up @@ -47,6 +49,8 @@ inputs:
title: "Info.plist file path"
summary: Path to the given target's Info.plist file. You need to use this Step for each archivable target of your project.
description: |
Path to the given target's Info.plist file. You need to use this Step for each archivable target of your project.
**NOTE:**<br/>
If your IPA contains multiple build targets, they would need to have the same version number as your app's main target has.<br/>
You need to add this Step to your Workflow for each build target: if you have, say, three targets, you need to have three instances of this Step in your Workflow.
Expand Down Expand Up @@ -79,4 +83,5 @@ inputs:
outputs:
- XCODE_BUNDLE_VERSION:
opts:
title: "The bundle version used in the Info.plist file"
title: Xcode Bundle Version
description: The bundle version used in the Info.plist file

0 comments on commit f0272f2

Please sign in to comment.