Skip to content

Commit

Permalink
Feature/17 provisioning profiles (#18)
Browse files Browse the repository at this point in the history
Co-authored-by: Edoardo Dusi <[email protected]>
Co-authored-by: Antonio Barile <[email protected]>
  • Loading branch information
3 people authored Jan 30, 2023
1 parent ed6c048 commit 728b539
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 29 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Change Log

## [2.1.0] - 2023-01-30

### Added

- `fastlane-env` (optional) input: Name of the env file name to pass to fastlane --env
- `ios-app-id` (optional) input: The iOS application identifier; useful to sync a specific provisioning profile

## [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.
- 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.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,29 @@ Browserstack username (**required if** browserstack-upload == true)

Browserstack access key (**required if** browserstack-upload == true)

### `fastlane-env`

Name of the env file name to pass to `fastlane --env`

### `ios-app-id`

The iOS application identifier; useful to sync a specific provisioning profile

## Contributions Welcome!

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`.

**NOTE:** Remember to run `yarn install` and `yarn bundle` if you make changes to the `index.js`.

## Example usage with a production build uploaded to App Store

```yaml
- uses: sparkfabrik/ios-build-action@v2.0.0
- uses: sparkfabrik/ios-build-action@v2.1.0
with:
upload-to-testflight: true
increment-build-number: true
build-pods: true
pods-path: 'ios/Podfile'
pods-path: "ios/Podfile"
configuration: Release
export-method: app-store
workspace-path: ${{ secrets.WORKSPACE_PATH }}
Expand All @@ -132,8 +141,10 @@ Remember to run `yarn install` and `yarn bundle` if you make changes to the `ind
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'
match-build-type: "appstore"
browserstack-upload: true
browserstack-username: ${{ secrets.BROWSERSTACK_USERNAME }}
browserstack-access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
fastlane-env: stage
ios-app-id: com.identifier.my_app
```
11 changes: 7 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,15 @@ inputs:
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 All @@ -91,6 +87,13 @@ inputs:
description: "Browserstack access key (required if browserstack-upload == true)"
required: false
default: ""
fastlane-env:
description: "Name of the env file name to pass to fastlane --env"
required: false
default: ""
ios-app-id:
description: "The iOS application identifier; useful to sync a specific provisioning profile"
required: false
runs:
using: "node16"
main: "dist/index.js"
9 changes: 8 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,11 @@ if [[ $BROWSERSTACK_UPLOAD = true || $BUILD_PODS = true ]]; then
bundle install
fi

fastlane build
# If the variable FASTLANE_ENV is set then run fastlane with the --env equal to the variable.
if [ -n "${FASTLANE_ENV}" ]; then
echo "Running fastlane with environment: ${FASTLANE_ENV}"
fastlane --env ${FASTLANE_ENV} build
else
echo "Running fastlane"
fastlane build
fi
13 changes: 5 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3333,8 +3333,7 @@ async function run() {
try {
if (
core.getInput("browserstack-upload").toLowerCase() === "true" &&
(!core.getInput("browserstack-username") ||
!core.getInput("browserstack-access-key"))
(!core.getInput("browserstack-username") || !core.getInput("browserstack-access-key"))
) {
throw new Error("Browserstack username or access key missing.");
}
Expand All @@ -3350,20 +3349,18 @@ async function run() {
process.env.SCHEME = core.getInput("scheme");
process.env.BROWSERSTACK_UPLOAD = core.getInput("browserstack-upload");
process.env.BROWSERSTACK_USERNAME = core.getInput("browserstack-username");
process.env.BROWSERSTACK_ACCESS_KEY = core.getInput(
"browserstack-access-key"
);
process.env.BROWSERSTACK_ACCESS_KEY = core.getInput("browserstack-access-key");
process.env.BUILD_PODS = core.getInput("build-pods");
process.env.PODS_PATH = core.getInput("pods-path");
process.env.MATCH_PASSWORD = core.getInput("match-password");
process.env.MATCH_GIT_URL = core.getInput("match-git-url");
process.env.MATCH_GIT_BASIC_AUTHORIZATION = core.getInput(
"match-git-basic-authorization"
);
process.env.MATCH_GIT_BASIC_AUTHORIZATION = core.getInput("match-git-basic-authorization");
process.env.MATCH_BUILD_TYPE = core.getInput("match-build-type");
process.env.APPLE_KEY_ID = core.getInput("apple-key-id");
process.env.APPLE_KEY_ISSUER_ID = core.getInput("apple-key-issuer-id");
process.env.APPLE_KEY_CONTENT = core.getInput("apple-key-content");
process.env.FASTLANE_ENV = core.getInput("fastlane-env");
process.env.IOS_APP_ID = core.getInput("ios-app-id");
await exec.exec(`bash ${__dirname}/../build.sh`);
} catch (error) {
core.setFailed(error.message);
Expand Down
5 changes: 5 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ platform :ios do
export_team_id: ENV['TEAM_ID'],
silent: true,
include_bitcode: true,
export_options: ENV['IOS_APP_ID'] != nil ? {
provisioningProfiles: {
"#{ENV['IOS_APP_ID']}" => "match AppStore #{ENV['IOS_APP_ID']}",
},
} : nil
)

if ENV["BROWSERSTACK_UPLOAD"] == 'true'
Expand Down
13 changes: 5 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ async function run() {
try {
if (
core.getInput("browserstack-upload").toLowerCase() === "true" &&
(!core.getInput("browserstack-username") ||
!core.getInput("browserstack-access-key"))
(!core.getInput("browserstack-username") || !core.getInput("browserstack-access-key"))
) {
throw new Error("Browserstack username or access key missing.");
}
Expand All @@ -22,20 +21,18 @@ async function run() {
process.env.SCHEME = core.getInput("scheme");
process.env.BROWSERSTACK_UPLOAD = core.getInput("browserstack-upload");
process.env.BROWSERSTACK_USERNAME = core.getInput("browserstack-username");
process.env.BROWSERSTACK_ACCESS_KEY = core.getInput(
"browserstack-access-key"
);
process.env.BROWSERSTACK_ACCESS_KEY = core.getInput("browserstack-access-key");
process.env.BUILD_PODS = core.getInput("build-pods");
process.env.PODS_PATH = core.getInput("pods-path");
process.env.MATCH_PASSWORD = core.getInput("match-password");
process.env.MATCH_GIT_URL = core.getInput("match-git-url");
process.env.MATCH_GIT_BASIC_AUTHORIZATION = core.getInput(
"match-git-basic-authorization"
);
process.env.MATCH_GIT_BASIC_AUTHORIZATION = core.getInput("match-git-basic-authorization");
process.env.MATCH_BUILD_TYPE = core.getInput("match-build-type");
process.env.APPLE_KEY_ID = core.getInput("apple-key-id");
process.env.APPLE_KEY_ISSUER_ID = core.getInput("apple-key-issuer-id");
process.env.APPLE_KEY_CONTENT = core.getInput("apple-key-content");
process.env.FASTLANE_ENV = core.getInput("fastlane-env");
process.env.IOS_APP_ID = core.getInput("ios-app-id");
await exec.exec(`bash ${__dirname}/../build.sh`);
} catch (error) {
core.setFailed(error.message);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "spark-ios-build-action",
"version": "2.0.0",
"version": "2.1.0",
"description": "",
"main": "index.js",
"scripts": {
Expand All @@ -18,4 +18,4 @@
"devDependencies": {
"@vercel/ncc": "0.34.0"
}
}
}

0 comments on commit 728b539

Please sign in to comment.