Skip to content

Commit

Permalink
Add unified ci support (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
tothszabi authored Feb 8, 2024
1 parent 6564248 commit 445ec66
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 187 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

[![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 to the specified version number.
Set the value of your iOS app's build number to the specified version number.

<details>
<summary>Description</summary>

Set the value of your iOS app's bundle version to the specified version number. A great way to keep track of versions
Set the value of your iOS app's build number 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.
Expand Down Expand Up @@ -56,8 +56,8 @@ You can also run this step directly with [Bitrise CLI](https://github.com/bitris
| `target` | Xcode Target name. It is optional and if specified then the step will find the given target and update the version numbers for it. If it is left empty then the step will use the scheme's default target to update the version numbers. | | |
| `configuration` | Xcode Configuration name. It is optional and if specified then the step will only update the configuration with the given name. If it is left empty then the step will update all of the target's configurations with the build and version number. | | |
| `build_version` | This will be either the CFBundleVersion in the Info.plist file or the CURRENT_PROJECT_VERSION in the project file. | required | `$BITRISE_BUILD_NUMBER` |
| `build_version_offset` | This offset will be added to `build_version` input's value. | | |
| `build_short_version_string` | This will be either the CFBundleShortVersionString in the Info.plist file or the MARKETING_VERSION in the project file. | | |
| `build_version_offset` | This offset will be added to `build_version` input's value. It must be a positive number. | | |
| `build_short_version_string` | This will be either the CFBundleShortVersionString in the Info.plist file or the MARKETING_VERSION in the project file. If it is empty then the step will not modify the existing value. | | |
</details>

<details>
Expand Down
109 changes: 12 additions & 97 deletions bitrise.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,22 @@
format_version: "13"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

app:
envs:
- PROJECT_ROOT: ./testdata/project/Example
- PROJECT_FILE: Example.xcodeproj
- WORKSPACE_ROOT: ./testdata/workspace/Example
- WORKSPACE_FILE: Example.xcworkspace
- GENERATED_NAME: Example
- STATIC_NAME: Example-Static

workflows:
test:
after_run:
- test-workspace-with-generated-plist
- test-workspace-with-static-plist
- test-project-with-generated-plist
- test-project-with-generated-plist

test-workspace-with-generated-plist:
envs:
- STEP_PATH: "$WORKSPACE_ROOT/$WORKSPACE_FILE"
- STEP_NAME: $GENERATED_NAME
- STEP_TYPE: workspace
- STEP_BUILD_ROOT: $WORKSPACE_ROOT
after_run:
- _set-build-and-assert

test-workspace-with-static-plist:
envs:
- STEP_PATH: "$WORKSPACE_ROOT/$WORKSPACE_FILE"
- STEP_NAME: $STATIC_NAME
- STEP_TYPE: workspace
- STEP_BUILD_ROOT: $WORKSPACE_ROOT
after_run:
- _set-build-and-assert
check:
steps:
- git::https://github.com/bitrise-steplib/steps-check.git: { }

test-project-with-generated-plist:
envs:
- STEP_PATH: "$PROJECT_ROOT/$PROJECT_FILE"
- STEP_NAME: $GENERATED_NAME
- STEP_TYPE: project
- STEP_BUILD_ROOT: $PROJECT_ROOT
after_run:
- _set-build-and-assert
e2e:
steps:
- git::https://github.com/bitrise-steplib/steps-check.git:
inputs:
- workflow: e2e

test-project-with-static-plist:
sample:
envs:
- STEP_PATH: "$PROJECT_ROOT/$PROJECT_FILE"
- STEP_NAME: $STATIC_NAME
- STEP_TYPE: project
- STEP_BUILD_ROOT: $PROJECT_ROOT
after_run:
- _set-build-and-assert

_set-build-and-assert:
- STEP_PATH: ./testdata/project/Example/Example.xcodeproj
- STEP_NAME: Example
steps:
- script:
title: Remove build dir
inputs:
- content: |
#!/bin/bash
set -ex
rm -rf $STEP_BUILD_ROOT/build
- path::./:
run_if: "true"
inputs:
Expand All @@ -73,45 +26,7 @@ workflows:
- build_version: 9994
- build_version_offset: 5
- build_short_version_string: 9.99.9
- script:
title: Build app
inputs:
- content: |
#!/bin/bash
set -ex
xcodebuild -$STEP_TYPE $STEP_PATH -scheme $STEP_NAME -sdk iphonesimulator -configuration Release SYMROOT=./build
- script:
title: Check version and build numbers
inputs:
- content: |
#!/bin/bash
set -ex
buildVersion=$(/usr/libexec/PlistBuddy "$STEP_BUILD_ROOT/build/Release-iphonesimulator/$STEP_NAME.app/Info.plist" -c "print CFBundleVersion")
buildShortVersion=$(/usr/libexec/PlistBuddy "$STEP_BUILD_ROOT/build/Release-iphonesimulator/$STEP_NAME.app/Info.plist" -c "print CFBundleShortVersionString")
if [ "$buildVersion" != "9999" ]; then
echo "CFBundleVersion is wrong"
exit 1
fi
if [ "$buildShortVersion" != "9.99.9" ]; then
echo "CFBundleShortVersionString is wrong"
exit 1
fi

generate-readme:
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:
steps:
- script:
inputs:
- content: |-
#!/bin/bash
set -ex
stepman audit --step-yml ./step.yml
95 changes: 95 additions & 0 deletions e2e/bitrise.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
format_version: "13"
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git

app:
envs:
- PROJECT_ROOT: ./testdata/project/Example
- PROJECT_FILE: Example.xcodeproj
- WORKSPACE_ROOT: ./testdata/workspace/Example
- WORKSPACE_FILE: Example.xcworkspace
- GENERATED_NAME: Example
- STATIC_NAME: Example-Static

workflows:
test-workspace-with-generated-plist:
envs:
- STEP_PATH: $WORKSPACE_ROOT/$WORKSPACE_FILE
- STEP_NAME: $GENERATED_NAME
- STEP_TYPE: workspace
- STEP_BUILD_ROOT: $WORKSPACE_ROOT
after_run:
- _set-build-and-assert

test-workspace-with-static-plist:
envs:
- STEP_PATH: $WORKSPACE_ROOT/$WORKSPACE_FILE
- STEP_NAME: $STATIC_NAME
- STEP_TYPE: workspace
- STEP_BUILD_ROOT: $WORKSPACE_ROOT
after_run:
- _set-build-and-assert

test-project-with-generated-plist:
envs:
- STEP_PATH: $PROJECT_ROOT/$PROJECT_FILE
- STEP_NAME: $GENERATED_NAME
- STEP_TYPE: project
- STEP_BUILD_ROOT: $PROJECT_ROOT
after_run:
- _set-build-and-assert

test-project-with-static-plist:
envs:
- STEP_PATH: $PROJECT_ROOT/$PROJECT_FILE
- STEP_NAME: $STATIC_NAME
- STEP_TYPE: project
- STEP_BUILD_ROOT: $PROJECT_ROOT
after_run:
- _set-build-and-assert

_set-build-and-assert:
steps:
- script:
title: Remove build dir
inputs:
- content: |
#!/bin/bash
set -ex
rm -rf $STEP_BUILD_ROOT/build
- path::./:
run_if: "true"
inputs:
- project_path: $STEP_PATH
- scheme: $STEP_NAME
- target: $STEP_NAME
- build_version: 9994
- build_version_offset: 5
- build_short_version_string: 9.99.9
- script:
title: Build app
inputs:
- content: |
#!/bin/bash
set -ex
xcodebuild -$STEP_TYPE $STEP_PATH -scheme $STEP_NAME -sdk iphonesimulator -configuration Release SYMROOT=./build
- script:
title: Check version and build numbers
inputs:
- content: |
#!/bin/bash
set -ex
buildVersion=$(/usr/libexec/PlistBuddy "$STEP_BUILD_ROOT/build/Release-iphonesimulator/$STEP_NAME.app/Info.plist" -c "print CFBundleVersion")
buildShortVersion=$(/usr/libexec/PlistBuddy "$STEP_BUILD_ROOT/build/Release-iphonesimulator/$STEP_NAME.app/Info.plist" -c "print CFBundleShortVersionString")
if [ "$buildVersion" != "9999" ]; then
echo "CFBundleVersion is wrong"
exit 1
fi
if [ "$buildShortVersion" != "9.99.9" ]; then
echo "CFBundleShortVersionString is wrong"
exit 1
fi
Loading

0 comments on commit 445ec66

Please sign in to comment.