Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ inputs:
required: false
platform:
description: |
Either `iOS`, `tvOS`, `macOS`, `watchOS`, `visionOS` or (more rarely)
Either `iOS`, `iOS-simulator`, `tvOS`, `macOS`, `watchOS`, `visionOS` or (more rarely)
`mac-catalyst`
Leave unset and `xcodebuild` decides itself.
required: false
Expand All @@ -38,6 +38,11 @@ inputs:
does without an action specified (usually `build`)
required: false
default: test
archive-path:
description: |
The path in which to store the resulting archive when running archive builds
Leave unset to use the default path
required: false
code-coverage:
description: Enables code coverage
required: false
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ async function main() {
const identity = getIdentity(core.getInput('code-sign-identity'), platform)
const currentVerbosity = verbosity()
const workspace = core.getInput('workspace')
const archivePath = core.getInput('archive-path')

core.info(`» Selected Xcode ${selected}`)

Expand All @@ -60,7 +61,7 @@ async function main() {
await configureKeychain()
await configureProvisioningProfiles()

await build(await getScheme(workspace), workspace, arch)
await build(await getScheme(workspace), workspace, arch, archivePath)

if (core.getInput('upload-logs') == 'always') {
await uploadLogs()
Expand Down Expand Up @@ -187,11 +188,16 @@ async function main() {
await createProvisioningProfiles(mobileProfiles, profiles)
}

async function build(scheme?: string, workspace?: string, arch?: Arch) {
async function build(
scheme?: string,
workspace?: string,
arch?: Arch,
archivePath?: string
) {
if (warningsAsErrors && actionIsTestable(action)) {
await xcodebuild('build', scheme, workspace, arch)
await xcodebuild('build', scheme, workspace, arch, archivePath)
}
await xcodebuild(action, scheme, workspace, arch)
await xcodebuild(action, scheme, workspace, arch, archivePath)
}

//// helper funcs
Expand All @@ -200,7 +206,8 @@ async function main() {
action?: string,
scheme?: string,
workspace?: string,
arch?: Arch
arch?: Arch,
archivePath?: string
) {
if (action === 'none') return

Expand All @@ -210,6 +217,7 @@ async function main() {
if (scheme) args = args.concat(['-scheme', scheme])
if (arch) args = args.concat([`-arch=${arch}`])
if (workspace) args = args.concat(['-workspace', workspace])
if (archivePath) args = args.concat(['-archivePath', archivePath])
if (identity) args = args.concat(identity)
if (currentVerbosity == 'quiet') args.push('-quiet')
if (configuration) args = args.concat(['-configuration', configuration])
Expand Down
3 changes: 3 additions & 0 deletions src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ export function getConfiguration(): string {
export type Platform =
| 'watchOS'
| 'iOS'
| 'iOS-simulator'
| 'tvOS'
| 'macOS'
| 'mac-catalyst'
Expand Down Expand Up @@ -386,6 +387,8 @@ export async function getDestination(
return ['-destination', `platform=macOS`]
case 'mac-catalyst':
return ['-destination', `platform=macOS,variant=Mac Catalyst`]
case 'iOS-simulator':
return ['-destination', `generic/platform=iOS Simulator`]
case undefined:
if (semver.gte(xcodeVersion, '13.0.0')) {
//FIXME should parse output from xcodebuild -showdestinations
Expand Down