Skip to content

Commit

Permalink
Merge pull request #9 from sparkfabrik/feature/fastlane_build_redesign
Browse files Browse the repository at this point in the history
Redesign the Fastlane build using Match
  • Loading branch information
edodusi authored Jun 14, 2022
2 parents f8ec2ee + 5717ea3 commit a33bb23
Show file tree
Hide file tree
Showing 11 changed files with 889 additions and 502 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

## [2.0.0] - 2022-10-06

Redesign of the Fastlane build and certificate handling.

### Breaking

- This version uses `Match` so you cannot use base64 version of the certificates, instead you need to have a GitHub repo that match will use to store the certificates and an Apple app key. Follow the README to see the new parameters list.
132 changes: 67 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,93 @@
# Build iOS App

This action builds your iOS project (`.xcodeproj`, `.xcworkspace`) and exports the resulting `.ipa` file as GitHub artifact, with optional automatic upload to BrowserStack AppLive.
This action builds your iOS project (`.xcodeproj`, `.xcworkspace`) and can export the resulting `.ipa` file as GitHub artifact, with optional automatic upload to BrowserStack AppLive, and optional signed production build with App Store upload.

Tested with Ionic, React Native and native ios projects.

Originally forked from `yukiarrr/ios-build-action`.
## WARNING v2 has breaking changes and it will break your non-pinned Actions!

## Inputs
To keep the old behavior please use the `v1` version.
`v2` uses `Match` to simplify and strenghten the certificates management, and can optionally upload the build to the App Store.

You can add a single p12 key+cert file with `p12-base64`, or if you have key and cert in separate files
you can add them with `p12-key-base64` and `p12-cer-base64`. One of the two options is required.
## Inputs

### `project-path`

**Required** .xcodeproj path.

### `p12-base64`
### `workspace-path`

**Required if single file**: Base64 encoded p12 file (key + cert).
.xcworkspace path. Default `""`.

### `p12-key-base64`
### `export-method`

**Required if split key/cert**: Base64 encoded p12 key file.
Choose app-store, `"ad-hoc"`, `"package"` `"enterprise"`, `"development"`, or `"developer-id"`. Default `"app-store"`.

### `p12-cer-base64`
### `configuration`

**Required if split key/cert**: Base64 encoded certificate for the p12 key.
For example, `"Debug"`, `"Release"`. Default `"Release"`.

### `mobileprovision-base64`
### `scheme`

**Required** Base64 encoded mobileprovision file.
For example, `MyScheme`.

### `code-signing-identity`
### `output-path`

**Required** For example, `"iOS Distribution"`.
Output path of ipa. Default `"output.ipa"`.

### `team-id`

**Required** Team id.

### `workspace-path`
### `team-name`

.xcworkspace path. Default `""`.
**Required** Team name.

### `export-method`
### `build-pods`

Choose app-store, `"ad-hoc"`, `"package"` `"enterprise"`, `"development"`, or `"developer-id"`. Default `"app-store"`.
Run the `pod install` command during the build (boolean)

### `configuration`
### `pods-path`

For example, `"Debug"`, `"Release"`. Default `"Release"`.
The path to the Podfile. Default `"Podfile"`

### `scheme`
### `upload-to-testflight`

For example, `"myscheme"`.
Upload the build to the App Store (boolean)

### `certificate-password`
### `increment-build-number`

Certificate password. Default `""`.
Automatically increment the latest build number from TestFlight by one (boolean)

### `output-path`
### `apple-key-id`

Output path of ipa. Default `"output.ipa"`.
The Apple Key ID

### `update-targets`
### `apple-key-issuer-id`

Targets to be updated with mobileprovision, code signing identity, etc. Split on new lines. Default `""`. (default to all targets)
The Apple Key Issuer ID

```yaml
- uses: sparkfabrik/[email protected]
with:
update-targets: |
MyApp
YourApp
```
### `apple-key-content`

### `disable-targets`
The Apple Key content

These targets will not use automatic code signing and instead use the identity specified in other inputs. Input targets separated by ','. For example, 'MyApp,YourApp'. Default "". (default to all targets)
### `match-git-url`

### `build-pods`
The GitHub repo URL for storing Match certificates.
See https://docs.fastlane.tools/actions/match/

Run the `pod install` command during the build.
### `match-git-basic-authorization`

### `pods-path`
base64 key to the repo.
Generate it with `echo -n your_github_username:your_personal_access_token | base64`

The path to the Podfile. Default `"Podfile"`
### `match-password`

The password to decrypt the certificates.

### `match-build-type`

The Match build type (eg. "development")

### `browserstack-upload`

Expand All @@ -106,31 +108,31 @@ Browserstack access key (**required if** browserstack-upload == true)
If you have any other inputs you'd like to add, feel free to create PR.
Remember to run `yarn install` and `yarn bundle` if you make changes to the `index.js`.

## Example usage

### single p12

```yaml
- uses: sparkfabrik/[email protected]
with:
project-path: App.xcodeproj
p12-base64: ${{ secrets.P12_BASE64 }}
mobileprovision-base64: ${{ secrets.MOBILEPROVISION_BASE64 }}
code-signing-identity: ${{ secrets.CODE_SIGNING_IDENTITY }}
team-id: ${{ secrets.TEAM_ID }}
workspace-path: App.xcworkspace # optional
```

### key and cert
## Example usage with a production build uploaded to App Store

```yaml
- uses: sparkfabrik/ios-build-action@v1.2.0
- uses: sparkfabrik/ios-build-action@v2
with:
project-path: App.xcodeproj
p12-key-base64: ${{ secrets.P12_KEY_BASE64 }}
p12-cer-base64: ${{ secrets.P12_CER_BASE64 }}
mobileprovision-base64: ${{ secrets.MOBILEPROVISION_BASE64 }}
code-signing-identity: ${{ secrets.CODE_SIGNING_IDENTITY }}
upload-to-testflight: true
increment-build-number: true
build-pods: true
pods-path: 'ios/Podfile'
configuration: Release
export-method: app-store
workspace-path: ${{ secrets.WORKSPACE_PATH }}
project-path: ${{ secrets.PROJECT_PATH }}
scheme: MyScheme
output-path: build-${{ github.sha }}.ipa
apple-key-id: ${{ secrets.APPLE_KEY_ID }}
apple-key-issuer-id: ${{ secrets.APPLE_KEY_ISSUER_ID }}
apple-key-content: ${{ secrets.APPLE_KEY_CONTENT }}
team-id: ${{ secrets.TEAM_ID }}
workspace-path: App.xcworkspace # optional
team-name: ${{ secrets.TEAM_NAME }}
match-password: ${{ secrets.MATCH_PASSWORD }}
match-git-url: ${{ secrets.MATCH_GIT_URL }}
match-git-basic-authorization: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
match-build-type: 'appstore'
browserstack-upload: true
browserstack-username: ${{ secrets.BROWSERSTACK_USERNAME }}
browserstack-access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
```
59 changes: 36 additions & 23 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,32 @@ branding:
color: "white"
description: "Build iOS project (.xcodeproj, .xcworkspace), export .ipa, optional upload to BrowserStack App Live."
inputs:
project-path:
description: "Project path"
required: true
p12-key-base64:
description: "Base64 encoded p12 key"
required: false
p12-cer-base64:
description: "Base64 encoded certificate for the p12 key"
upload-to-testflight:
description: "Upload to TestFlight."
required: false
p12-base64:
description: "Base64 encoded p12 file (key + cert)"
default: false
increment-build-number:
description: "Increment build number."
required: false
mobileprovision-base64:
description: "Base64 encoded mobileprovision file"
required: true
code-signing-identity:
description: "For example, iOS Distribution"
default: false
project-path:
description: "Project path"
required: true
team-id:
description: "Team id"
required: true
team-name:
description: "Team name"
required: true
apple-key-id:
description: "Apple key id"
required: true
apple-key-issuer-id:
description: "Apple key issuer id"
required: true
apple-key-content:
description: "Apple key content"
required: true
workspace-path:
description: "Workspace path"
required: false
Expand All @@ -38,10 +43,6 @@ inputs:
description: "For example, Debug, Release"
required: false
default: "Release"
certificate-password:
description: "Certificate password"
required: false
default: ""
output-path:
description: "Output path of ipa"
required: false
Expand All @@ -54,10 +55,6 @@ inputs:
description: "Targets to be updated with mobileprovision, code signing identity, etc"
required: false
default: ""
disable-targets:
description: "Targets to disable automatic code signing. Input targets separated by ,. For example, 'MyApp,YourApp'."
required: false
default: ""
build-pods:
description: "Boolean to tell if `pod install` should be run during build."
required: false
Expand All @@ -66,6 +63,22 @@ inputs:
description: "The path to the Podfile."
required: false
default: "Podfile"
match-password:
description: "The password to decrypt certificates."
required: true
default: false
match-git-url:
description: "The git url where match can find the certificates."
required: true
default: false
match-git-basic-authorization:
description: "The basic authorization to access the repository."
required: true
default: false
match-build-type:
description: "The build type to use when building the app."
required: true
default: false
browserstack-upload:
description: "Boolean to tell the Action to upload the .ipa to Browserstack App Live after the build."
required: false
Expand Down
12 changes: 2 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,8 @@ script_path=$(cd $(dirname ${0}); pwd)
cp -r ${script_path}/fastlane ./
cp -r ${script_path}/Gemfile ./

if [[ ! -z $P12_KEY_BASE64 && ! -z $P12_CER_BASE64 ]]; then
echo $P12_KEY_BASE64 | base64 --decode > ios-build-key.p12
echo $P12_CER_BASE64 | base64 --decode > ios-build-key.cer
export CERTIFICATE_SPLIT=1
else
echo $P12_BASE64 | base64 --decode > ios-build.p12
fi
echo $MOBILEPROVISION_BASE64 | base64 --decode > ios-build.mobileprovision

if [[ $BROWSERSTACK_UPLOAD = true || $BUILD_PODS = true ]]; then
bundle install
fi
fastlane export_ipa

fastlane build
Loading

0 comments on commit a33bb23

Please sign in to comment.