Skip to content

Commit ab278c3

Browse files
authored
Merge pull request #5 from sparkfabrik/feature/react-native-support
React Native support
2 parents 6f2bfb1 + cb13cf5 commit ab278c3

File tree

12 files changed

+309
-226
lines changed

12 files changed

+309
-226
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
yarn-error.log

Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
source 'https://rubygems.org'
22

3+
gem 'cocoapods'
4+
35
plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
4-
eval(File.read(plugins_path), binding) if File.exist?(plugins_path)
6+
eval(File.read(plugins_path), binding) if File.exist?(plugins_path)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 yukiarrr, SparkFabrik
3+
Copyright (c) 2020 SparkFabrik
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ Output path of ipa. Default `"output.ipa"`.
6565

6666
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)
6767

68+
### `build-pods`
69+
70+
Run the `pod install` command during the build.
71+
72+
### `pods-path`
73+
74+
The path to the Podfile. Default `"Podfile"`
75+
6876
### `browserstack-upload`
6977

7078
Set this to true to upload the resulting .ipa file to Browserstack App Live right after the build (https://www.browserstack.com/docs/app-live/integrations/fastlane)
@@ -82,8 +90,7 @@ Browserstack access key (**required if** browserstack-upload == true)
8290
## Contributions Welcome!
8391

8492
If you have any other inputs you'd like to add, feel free to create PR.
85-
86-
Welcome your contributions!
93+
Remember to run `yarn install` and `yarn bundle` if you make changes to the `index.js`.
8794

8895
## Example usage
8996

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ inputs:
5454
description: "Targets to disable automatic code signing. Input targets separated by ,. For example, 'MyApp,YourApp'."
5555
required: false
5656
default: ""
57+
build-pods:
58+
description: "Boolean to tell if `pod install` should be run during build."
59+
required: false
60+
default: false
61+
pods-path:
62+
description: "The path to the Podfile."
63+
required: false
64+
default: "Podfile"
5765
browserstack-upload:
5866
description: "Boolean to tell the Action to upload the .ipa to Browserstack App Live after the build."
5967
required: false

build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ else
2121
fi
2222
echo $MOBILEPROVISION_BASE64 | base64 --decode > ios-build.mobileprovision
2323

24-
if [[ $BROWSERSTACK_UPLOAD = true ]]; then
24+
if [[ $BROWSERSTACK_UPLOAD = true || $BUILD_PODS = true ]]; then
2525
bundle install
2626
fi
2727
fastlane export_ipa

dist/index.js

Lines changed: 102 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ module.exports =
22
/******/ (() => { // webpackBootstrap
33
/******/ var __webpack_modules__ = ({
44

5-
/***/ 977:
5+
/***/ 932:
66
/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
77

8-
const core = __webpack_require__(519);
9-
const exec = __webpack_require__(372);
8+
const core = __webpack_require__(186);
9+
const exec = __webpack_require__(514);
1010

1111
async function run() {
1212
try {
1313
// Validate p12 keys.
1414
if (!core.getInput("p12-base64")
15-
&& (!core.getInput("p12-cer-base64") || !core.getInput("p12-cer-base64"))) {
15+
&& (!core.getInput("p12-cer-base64") || !core.getInput("p12-key-base64"))) {
1616
throw new Error("P12 keys missing or in the wrong format.");
1717
}
1818
if (core.getInput("browserstack-upload").toLowerCase() === 'true'
@@ -38,6 +38,8 @@ async function run() {
3838
process.env.BROWSERSTACK_UPLOAD = core.getInput("browserstack-upload");
3939
process.env.BROWSERSTACK_USERNAME = core.getInput("browserstack-username");
4040
process.env.BROWSERSTACK_ACCESS_KEY = core.getInput("browserstack-access-key");
41+
process.env.BUILD_PODS = core.getInput("build-pods");
42+
process.env.PODS_PATH = core.getInput("pods-path");
4143
await exec.exec(`bash ${__dirname}/../build.sh`);
4244
} catch (error) {
4345
core.setFailed(error.message);
@@ -49,7 +51,7 @@ run();
4951

5052
/***/ }),
5153

52-
/***/ 652:
54+
/***/ 351:
5355
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
5456

5557
"use strict";
@@ -63,6 +65,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
6365
};
6466
Object.defineProperty(exports, "__esModule", ({ value: true }));
6567
const os = __importStar(__webpack_require__(87));
68+
const utils_1 = __webpack_require__(278);
6669
/**
6770
* Commands
6871
*
@@ -116,28 +119,14 @@ class Command {
116119
return cmdStr;
117120
}
118121
}
119-
/**
120-
* Sanitizes an input into a string so it can be passed into issueCommand safely
121-
* @param input input to sanitize into a string
122-
*/
123-
function toCommandValue(input) {
124-
if (input === null || input === undefined) {
125-
return '';
126-
}
127-
else if (typeof input === 'string' || input instanceof String) {
128-
return input;
129-
}
130-
return JSON.stringify(input);
131-
}
132-
exports.toCommandValue = toCommandValue;
133122
function escapeData(s) {
134-
return toCommandValue(s)
123+
return utils_1.toCommandValue(s)
135124
.replace(/%/g, '%25')
136125
.replace(/\r/g, '%0D')
137126
.replace(/\n/g, '%0A');
138127
}
139128
function escapeProperty(s) {
140-
return toCommandValue(s)
129+
return utils_1.toCommandValue(s)
141130
.replace(/%/g, '%25')
142131
.replace(/\r/g, '%0D')
143132
.replace(/\n/g, '%0A')
@@ -148,7 +137,7 @@ function escapeProperty(s) {
148137

149138
/***/ }),
150139

151-
/***/ 519:
140+
/***/ 186:
152141
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
153142

154143
"use strict";
@@ -170,7 +159,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
170159
return result;
171160
};
172161
Object.defineProperty(exports, "__esModule", ({ value: true }));
173-
const command_1 = __webpack_require__(652);
162+
const command_1 = __webpack_require__(351);
163+
const file_command_1 = __webpack_require__(717);
164+
const utils_1 = __webpack_require__(278);
174165
const os = __importStar(__webpack_require__(87));
175166
const path = __importStar(__webpack_require__(622));
176167
/**
@@ -197,9 +188,17 @@ var ExitCode;
197188
*/
198189
// eslint-disable-next-line @typescript-eslint/no-explicit-any
199190
function exportVariable(name, val) {
200-
const convertedVal = command_1.toCommandValue(val);
191+
const convertedVal = utils_1.toCommandValue(val);
201192
process.env[name] = convertedVal;
202-
command_1.issueCommand('set-env', { name }, convertedVal);
193+
const filePath = process.env['GITHUB_ENV'] || '';
194+
if (filePath) {
195+
const delimiter = '_GitHubActionsFileCommandDelimeter_';
196+
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
197+
file_command_1.issueCommand('ENV', commandValue);
198+
}
199+
else {
200+
command_1.issueCommand('set-env', { name }, convertedVal);
201+
}
203202
}
204203
exports.exportVariable = exportVariable;
205204
/**
@@ -215,7 +214,13 @@ exports.setSecret = setSecret;
215214
* @param inputPath
216215
*/
217216
function addPath(inputPath) {
218-
command_1.issueCommand('add-path', {}, inputPath);
217+
const filePath = process.env['GITHUB_PATH'] || '';
218+
if (filePath) {
219+
file_command_1.issueCommand('PATH', inputPath);
220+
}
221+
else {
222+
command_1.issueCommand('add-path', {}, inputPath);
223+
}
219224
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
220225
}
221226
exports.addPath = addPath;
@@ -377,7 +382,69 @@ exports.getState = getState;
377382

378383
/***/ }),
379384

380-
/***/ 372:
385+
/***/ 717:
386+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
387+
388+
"use strict";
389+
390+
// For internal use, subject to change.
391+
var __importStar = (this && this.__importStar) || function (mod) {
392+
if (mod && mod.__esModule) return mod;
393+
var result = {};
394+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
395+
result["default"] = mod;
396+
return result;
397+
};
398+
Object.defineProperty(exports, "__esModule", ({ value: true }));
399+
// We use any as a valid input type
400+
/* eslint-disable @typescript-eslint/no-explicit-any */
401+
const fs = __importStar(__webpack_require__(747));
402+
const os = __importStar(__webpack_require__(87));
403+
const utils_1 = __webpack_require__(278);
404+
function issueCommand(command, message) {
405+
const filePath = process.env[`GITHUB_${command}`];
406+
if (!filePath) {
407+
throw new Error(`Unable to find environment variable for file command ${command}`);
408+
}
409+
if (!fs.existsSync(filePath)) {
410+
throw new Error(`Missing file at path: ${filePath}`);
411+
}
412+
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
413+
encoding: 'utf8'
414+
});
415+
}
416+
exports.issueCommand = issueCommand;
417+
//# sourceMappingURL=file-command.js.map
418+
419+
/***/ }),
420+
421+
/***/ 278:
422+
/***/ ((__unused_webpack_module, exports) => {
423+
424+
"use strict";
425+
426+
// We use any as a valid input type
427+
/* eslint-disable @typescript-eslint/no-explicit-any */
428+
Object.defineProperty(exports, "__esModule", ({ value: true }));
429+
/**
430+
* Sanitizes an input into a string so it can be passed into issueCommand safely
431+
* @param input input to sanitize into a string
432+
*/
433+
function toCommandValue(input) {
434+
if (input === null || input === undefined) {
435+
return '';
436+
}
437+
else if (typeof input === 'string' || input instanceof String) {
438+
return input;
439+
}
440+
return JSON.stringify(input);
441+
}
442+
exports.toCommandValue = toCommandValue;
443+
//# sourceMappingURL=utils.js.map
444+
445+
/***/ }),
446+
447+
/***/ 514:
381448
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
382449

383450
"use strict";
@@ -399,7 +466,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
399466
return result;
400467
};
401468
Object.defineProperty(exports, "__esModule", ({ value: true }));
402-
const tr = __importStar(__webpack_require__(694));
469+
const tr = __importStar(__webpack_require__(159));
403470
/**
404471
* Exec a command.
405472
* Output will be streamed to the live console.
@@ -428,7 +495,7 @@ exports.exec = exec;
428495

429496
/***/ }),
430497

431-
/***/ 694:
498+
/***/ 159:
432499
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
433500

434501
"use strict";
@@ -454,8 +521,8 @@ const os = __importStar(__webpack_require__(87));
454521
const events = __importStar(__webpack_require__(614));
455522
const child = __importStar(__webpack_require__(129));
456523
const path = __importStar(__webpack_require__(622));
457-
const io = __importStar(__webpack_require__(853));
458-
const ioUtil = __importStar(__webpack_require__(400));
524+
const io = __importStar(__webpack_require__(436));
525+
const ioUtil = __importStar(__webpack_require__(962));
459526
/* eslint-disable @typescript-eslint/unbound-method */
460527
const IS_WINDOWS = process.platform === 'win32';
461528
/*
@@ -1035,7 +1102,7 @@ class ExecState extends events.EventEmitter {
10351102

10361103
/***/ }),
10371104

1038-
/***/ 400:
1105+
/***/ 962:
10391106
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
10401107

10411108
"use strict";
@@ -1237,7 +1304,7 @@ function isUnixExecutable(stats) {
12371304

12381305
/***/ }),
12391306

1240-
/***/ 853:
1307+
/***/ 436:
12411308
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
12421309

12431310
"use strict";
@@ -1255,7 +1322,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
12551322
const childProcess = __webpack_require__(129);
12561323
const path = __webpack_require__(622);
12571324
const util_1 = __webpack_require__(669);
1258-
const ioUtil = __webpack_require__(400);
1325+
const ioUtil = __webpack_require__(962);
12591326
const exec = util_1.promisify(childProcess.exec);
12601327
/**
12611328
* Copies a file or folder.
@@ -1628,6 +1695,6 @@ module.exports = require("util");
16281695
/******/ // module exports must be returned from runtime so entry inlining is disabled
16291696
/******/ // startup
16301697
/******/ // Load entry module and return exports
1631-
/******/ return __webpack_require__(977);
1698+
/******/ return __webpack_require__(932);
16321699
/******/ })()
16331700
;

fastlane/Fastfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ platform :ios do
5353
path: ENV["PROJECT_PATH"],
5454
teamid: ENV["TEAM_ID"]
5555
)
56+
if ENV["BUILD_PODS"] == 'true'
57+
cocoapods(
58+
podfile: ENV["PODS_PATH"]
59+
)
60+
end
5661
if ENV["WORKSPACE_PATH"] != ""
5762
build_app(
5863
workspace: ENV["WORKSPACE_PATH"],

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ async function run() {
55
try {
66
// Validate p12 keys.
77
if (!core.getInput("p12-base64")
8-
&& (!core.getInput("p12-cer-base64") || !core.getInput("p12-cer-base64"))) {
8+
&& (!core.getInput("p12-cer-base64") || !core.getInput("p12-key-base64"))) {
99
throw new Error("P12 keys missing or in the wrong format.");
1010
}
1111
if (core.getInput("browserstack-upload").toLowerCase() === 'true'
@@ -31,6 +31,8 @@ async function run() {
3131
process.env.BROWSERSTACK_UPLOAD = core.getInput("browserstack-upload");
3232
process.env.BROWSERSTACK_USERNAME = core.getInput("browserstack-username");
3333
process.env.BROWSERSTACK_ACCESS_KEY = core.getInput("browserstack-access-key");
34+
process.env.BUILD_PODS = core.getInput("build-pods");
35+
process.env.PODS_PATH = core.getInput("pods-path");
3436
await exec.exec(`bash ${__dirname}/../build.sh`);
3537
} catch (error) {
3638
core.setFailed(error.message);

0 commit comments

Comments
 (0)