{"id":19188803,"url":"https://github.com/miquido/mqswiftsign","last_synced_at":"2025-05-08T02:47:45.336Z","repository":{"id":150666340,"uuid":"623391781","full_name":"miquido/MQSwiftSign","owner":"miquido","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-06T13:39:07.000Z","size":22471,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-20T06:35:01.272Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/miquido.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-04-04T09:26:31.000Z","updated_at":"2024-12-06T13:39:12.000Z","dependencies_parsed_at":"2023-04-14T11:45:58.990Z","dependency_job_id":"ffb629a7-934a-4f2f-89a4-9b4b9bca38b2","html_url":"https://github.com/miquido/MQSwiftSign","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2FMQSwiftSign","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2FMQSwiftSign/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2FMQSwiftSign/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/miquido%2FMQSwiftSign/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/miquido","download_url":"https://codeload.github.com/miquido/MQSwiftSign/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252989944,"owners_count":21836665,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T11:26:04.836Z","updated_at":"2025-05-08T02:47:45.310Z","avatar_url":"https://github.com/miquido.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MQSwiftSign\n\nA tool that facilitates development of your native iOS, Flutter and React Native applications by preparing your macOS environment to be ready for Xcode to build and codesign your application.\n\nThe main uses of this tool are CI systems, but you can use it as well on your daily development setup.\n\n## Features:\n\n1. Keychain preparation, which consists of:\n\t- Check out for any previous keychain leftovers and if there are any, remove them.\n\t- Decode provided base64 certificate data into structure that can be later imported into the keychain.\n\t- Create temporary keychain with specified name, unlocked and with password prompt turned off.\n\t- Install certificate into just created keychain.\n\t- Add temporary keychain to the keychain searchlist.\n\t- Set up proper access options for the certificate and its private key.\n2. Installation of any provisioning profile found in specified path, making it visible for Xcode. See [installing provisioning profiles](#installing-provisioning-profiles) for more information.\n3. Execution of a provided shell script.\n4. Composition of an export plist from build options provided in shell script. See [creating options plist](#creating-export-plist) for more information.\n5. Cleanup of any used resources, restoring environment to its neutral state.\n\nBasically, it does the same work as `fastlane match`, but stripped of unnecessary bloatware and rubygem dependencies, making it swift and clean.\n\n\u003e NOTE: It is your responsibility to provide proper signing identity for the build. The tool doesn't check if the certificate or private key you're trying to import matches your build type; If you're trying to codesign e.g. Testflight build using development identity, be aware that build will fail on the codesign step. Check in Xcode which signing identity you use for particular build configuration and export it. \nThe same rule applies to provided provisioning profiles - if using the tool with --provisioningPath option, profiles have to match selected project configuration, because the tool will just install any profile contained in provided directory. If wrong provisioning profile is provided, the build command will fail as well.\n\n## Usage\n\nFor your convenience, we packed the usage of the tool into the [makefile](./Makefile) and bundled it up with most common use cases of the tool. It covers executable building, unit tests, app building \u0026 uploading it to Testflight.\n\nAll configuration is done inside [project.env](./project.env) file.\n\nSimply copy the executable along `Makefile` and `project.env` to your project directory, update properties in `project.env`, and you are ready to go! \n\nThe makefile is prepared to run on any macOS with Xcode installed.\n\n### Package or executable?\n\nYou can use the tool as swift package or as standalone binary. The standalone binary is recommended way, and all examples are set up with assumption that you use standalone binary.\n\nTo build a standalone binary, clone this repository and run `make build_universal_binary` in main directory. This will build an executable and place it under `./MQSwiftSign`. You can then copy it into your project.\n\nNote that this action will build a fat binary, which will run on both Intel and Apple Sillicon processors. If you don't need a fat binary, just strip unnecessary arch from `build_universal_binary` action. \n\nHowever, if you find yourself in need of Swift package use (e.g. you have to customize its behavior, or incorporate it into your custom swift package setup) then replace in examples `./MQSwiftSign` with `swift run --package-path \u003cpath_to_MQSwiftSign\u003e`.\n\n\n### Detailed usage\n\n#### With makefile\n\nIn the makefile, set up required variables and execute action: \n\n```\nmake ios_build_and_upload\n```\n\nor \n\n```\nmake flutter_build_and_upload\n```\n\nThe tool will automatically prepare, build and upload your iOS application to Testflight - no more work required!\n\n\u003e NOTE: For React Native applications you should use native iOS actions.\n\nCheck out the [makefile](./Makefile) to see more actions and details of usage.\n\n#### Without makefile\n\nIf, for some reason, you don't want to use Makefile, you can use the tool directly. Detailed description of tool parameters can be found [below](#tool-command-parameters). \n\nThe tool provides two subcommands: \n\n1. `prepare` which sets up the keychain ready for codesigning\n2. `cleanup` which cleans up resources used by the script. \n\nPlease note, that in this mode, you can't use the `--distribution-method` parameter, as the tool doesn't have the project configuration context to compose Export.plist from.\n\n##### Samples of non-makefile usage:\n\n- Preparing keychain for build:\n\n```\n./MQSwiftSign prepare $CERT_CONTENT --cert-password $CERT_PASSWORD \u003cother_arguments_if_needed\u003e\n```\n\n- Cleaning up after build:\n```\n./MQSwiftSign cleanup\n```\n\n- Full flutter build setup: \n\n```\n./MQSwiftSign prepare $CERT_CONTENT --cert-password $CERT_PASSWORD --keychain-name $KEYCHAIN_NAME --keychain-password $KEYCHAIN_PASSWORD --provisioning-path \"../Provisionings/\"\nflutter build ipa --release --export-options-plist=./export.plist\n./MQSwiftSign cleanup\n```\n\n- Full iOS/React Native build setup: \n```\n./MQSwiftSign prepare $CERT_CONTENT --cert-password $CERT_PASSWORD --keychain-name $KEYCHAIN_NAME --keychain-password $KEYCHAIN_PASSWORD --provisioning-path \"../Provisionings/\"\nxcodebuild archive -project MyProject.xcodeproj -scheme SchemeName -configuration ConfigurationName -archivePath ./MyProject.xcarchive -destination 'generic/platform=iOS'\nxcodebuild -exportArchive -archivePath ./MyProject.xcarchive -exportPath ./artifact -exportOptionsPlist export.plist -destination 'generic/platform=iOS'\n./MQSwiftSign cleanup\n```\n\n### Tool command parameters\n\nYou can get these informations running `./MQSwiftSign --help` as well.\n\n\u003e NOTE: It is recommended to not provide sensitive data, in particular cert content or cert password, directly, but rather to pass it using env vars.\n\n#### Required:\n\n`--cert-content`: Argument. Base64 encoded certificate content. You can get one by calling `cat \u003ccert_file\u003e.p12 | base64`.\n\n#### Optional parameters: \n\n`--cert-password`: Password to decrypt certificate. This is the same password you have used to export certificate from your keychain. Empty string by default or if omitted.\n\n`--keychain-name`: Name of the temporary keychain file used to store cert for the building time.\n\nAlthough tool will use random generated string for this if not provided, it is recommended to provide your own name e.g. based on project name, you might want to provide one for debugging purposes.\n\n\u003e NOTE: If you have been using that property already and you plan to change keychain name to another one, it is recommended to call `cleanup` action first, before preparing keychain with the new name - to make sure that there are no leftovers in the system.\n\n`--keychain-password`: password for the temporary keychain.\n\nThe tool will use random generated UUID based password if not provided, however, you might want to provide one for debugging purposes.\n\n#### Optional actions:\n\n`--shell-script`: Script to be executed after keychain creation. Intended to contain build commands for particular platform. If provided, after execution of the script, tool will clean up any used resources.\n\n`--provisioning-path`: Relative path to a directory which contains provisioning profiles to be installed. If not provided, the default path is current process working directory path.\n\nFor more info, please see [installing provisioning profiles](#installing-provisioning-profiles).\n\n`--distribution-method`: The app distribution method. If this parameter is provided along with the `--shell-script` argument, and build commands are included in the script, the tool will attempt to extract necessary information from the project file. The resulting plist file will be generated at the path specified in the build command options. If no path is provided, a default path will be used.\n\n\u003e NOTE: If this parameter is omitted then no export plist file will be created. Valid distribution methods are: validation, package, enterprise, development, app-store, ad-hoc, development-id, mac-application.\n\nFor more info, please see [creating options plist](#creating-export-plist).\n\n#### Misc\n\n`--custom-acls`: Custom ACL groups/partitions to which access to the imported certificate will be granted.\n\n`--applications`: Absolute paths to apps that are allowed access to the imported certificate without user confirmation.\n\n## Additional features\nAs an addition to importing certificates, the tool provides features described below.\n\n### Installing provisioning profiles\nTo install provisioning profiles the `--provisioning-path` should point at a **directory** that contains those provisioning profiles.\nThe tool searches there for all `*.mobileprovision` files in that directory and copies them to the `~/Library/MobileDevices/Provisioning Profiles/` directory. \nWhile copying files the tool takes the UUID from each provisioning profile and uses it as destination file's name.\n\n### Creating export plist\nThe tool can create and export plist file with the project's configuration if needed. To create the export plist the following conditions should be satisfied:\n1. The `--shell-script` parameter must contain a proper build command (`xcodebuild`, `flutter build` etc)\n2. The `--distribution-method` parameter must be given\nFor example of that, please see `ios_build_and_upload` action from [makefile](./Makefile). \n\nIf you use makefile actions, the tool will take care of that for you.\n\nThe export plist content is created based on the project configuration and the given `--distribution-method`. \nFor `xcodebuild` command, it must contain the following parameters:\n- `-project` or `-workspace` in order to fetch project/workspace content like targets and dependencies\n- either `-scheme` or `-target` in order to fetch build settings (sign style, team ID, provisioning profile specifiers etc.) based on the given configuration - if configuration is not provided, the default one will be inferred\n- `-exportOptionsPlist` for fetching the path at which the export plist file should be saved.\n- an optional `-sdk` if the project has multiple destination platforms (iOS, iPadOS, tvOS).\n\nFor the `flutter build` command, the tool anticipates the default scheme and target name for iOS builds (which is `Runner`) and executes similar actions as in `xcodebuild` case.\n\nThe tool supports nested dependencies - meaning that, if your project uses separate app extension (for watchOS, rich notifications etc.) the output plist will support it.\n\nIf needed (see the above conditions) MQSwiftSign tries to create the export option plist and then runs the given `--shell-script` in first place. This way, while executing the build command, the export option plist is already created and saved at the specified path.   \n\nNote that this feature is only available when using makefile's actions. When using commands directly, the tool has no project configuration context to create a plist from.\n\n## License\n\nCopyright 2023 Miquido\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiquido%2Fmqswiftsign","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmiquido%2Fmqswiftsign","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmiquido%2Fmqswiftsign/lists"}