Skip to content

Commit 7bc5c23

Browse files
BirmacherAkosgodrei
authored andcommitted
Copy the .ipa/.pkg to tmp folder (#44)
* It will copy the .ipa or .pkg to a tmp folder and rename them to tmp.ipa/tmp.pkg to prevent the fastlane error: "... in the package contains an invalid character(s). The valid characters are: A-Z, a-z, 0-9, dash, period, underscore, but the name cannot start with a dash, period, or underscore" * If we can't copy the .ipa/.pkg to the tmp folder we will use the original one. * build version offset fix;
1 parent 32dbccc commit 7bc5c23

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

bitrise.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ workflows:
5656
run_if: true
5757
inputs:
5858
- plist_path: $INFO_PLIST_PATH
59-
- build_version_offset: 72
59+
- build_version_offset: 74
6060
- xcode-archive:
6161
title: Create Archive
6262
inputs:

main.go

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ This means that when the API changes
367367
}
368368

369369
if configs.ITMSParameters != "" {
370-
envs = append(envs, fmt.Sprintf("DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS=%s", configs.ITMSParameters))
370+
envs = append(envs, fmt.Sprintf("DELIVER_ITMSTRANSPORTER_ADDITIONAL_UPLOAD_PARAMETERS=%s", configs.ITMSParameters))
371371
}
372372

373373
args := []string{
@@ -398,9 +398,20 @@ This means that when the API changes
398398
}
399399

400400
if configs.IpaPath != "" {
401-
args = append(args, "--ipa", configs.IpaPath)
401+
tmpIpaPath, err := normalizeArtifactPath(configs.IpaPath)
402+
if err != nil {
403+
log.Warnf("failed to copy the %s to the temporarily dir, error: %s", filepath.Base(configs.IpaPath), err)
404+
tmpIpaPath = configs.IpaPath
405+
}
406+
args = append(args, "--ipa", tmpIpaPath)
407+
402408
} else if configs.PkgPath != "" {
403-
args = append(args, "--pkg", configs.PkgPath)
409+
tmpPkgPath, err := normalizeArtifactPath(configs.PkgPath)
410+
if err != nil {
411+
log.Warnf("failed to copy the %s to the temporarily dir, error: %s", filepath.Base(configs.PkgPath), err)
412+
tmpPkgPath = configs.PkgPath
413+
}
414+
args = append(args, "--pkg", tmpPkgPath)
404415
}
405416

406417
if configs.SkipScreenshots == "yes" {
@@ -443,3 +454,17 @@ This means that when the API changes
443454
log.Donef("Success")
444455
log.Printf("The app (.ipa) was successfully uploaded to [iTunes Connect](https://itunesconnect.apple.com), you should see it in the *Prerelease* section on the app's iTunes Connect page!")
445456
}
457+
458+
func normalizeArtifactPath(pth string) (string, error) {
459+
tmpDir, err := pathutil.NormalizedOSTempDirPath("ipaOrPkg")
460+
if err != nil {
461+
return "", err
462+
}
463+
464+
tmpPath := filepath.Join(tmpDir, "tmp"+filepath.Ext(pth))
465+
if err := command.CopyFile(pth, tmpPath); err != nil {
466+
return "", err
467+
}
468+
469+
return tmpPath, nil
470+
}

0 commit comments

Comments
 (0)