-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Xcode Cloud CI #758
Conversation
@mvasilak looks good, would be great if you could alter the |
Sorry, could you give an example of what this is doing? Do you mean the minor part as in the "19" in "1.0.19" or the "189" in "10.0.19-189"? |
My bad, it updates the patch part of major.minor.patch semantic version, I corrected the description. The build number is decided by the Xcode Cloud autoincremented value. I'll implement @michalrentka's recommendation to select which part of the version to update, by updating the |
I still don't understand what this is for, though. We don't want to update the patch component on each TestFlight build that we make. Can you explain the purpose of this? |
@mvasilak if possible we should also include incrementing build number so that we don't have to use tags for that. |
The script fetches via the API the currently released version. E.g. currently it is If the script is updated to allow for bumping minor or major versions, that would result in the current example to |
Just correction on my part, I meant build number in post-build script so that the final tag contains proper build number. |
Build number is incremented automatically by Xcode Cloud. And since TestFlight description will be set automatically, it will be easy to understand where each build comes from. Of course we can further improve this generated description. |
But when would this be triggered? Aren't these scripts for Xcode Cloud? How is that related to updating the version number? |
Got it, will look into it. |
Oh, OK, I guess this is the part that I was missing. |
@dstillman the whole idea is that we can simply call the push build script and it relies on actual version of app in app store instead of our tags in repo, which can get out of sync with real app version. So you'd call The advantage is that you'd trigger the build process by submitting a tag like "new build" or something similar, Xcode cloud is triggered, does all mentioned above, removes the temporary "new build" tag and tags last commit with proper "1.0.20-189" for example. So we'd have our format of tags but we rely on app store API for actual real values. |
The whole idea is that we don't need to thoroughly maintain the version number in the repository. That way we avoid the mistake of uploading an invalid version build, just because we forgot to bump it before building. Additionally, since we now use forks for development, if we build from a commit in a fork, then there is not one repo that will hold all build tags. The tag back that @michalrentka proposed will just be for informative purposes. The actual tag triggering a build would be a specific one, e.g. |
OK, got it, thanks. I'm a little concerned about the tag-cleaning part — I feel like tags in git have a habit of getting out of sync, though maybe they've improved this. It's possible we'll need to use But we can try this and see how it goes. |
4851382
to
b3ec23b
Compare
@michalrentka @dstillman latest additions do the following:
In post clone script:
In post build script:
There are some issues to consider:
|
I don't like that deleting tag makes the build unlisted but I guess we don't really have a choice. We could generate tags with random hashes but then we'd have just many unnecessary tags in repo. @dstillman any comments? The code looks good though. |
I was looking for a recent build in Xcode Cloud, because its artifacts is the only place AFAIK that you can get debug symbols from, which are necessary to symbolicate crash reports. I couldn't find it in the app store connect site, although the tag is still available in the repo. Maybe Xcode Cloud hides old builds after a while? The same build is visible in the Xcode app, by going to If that is the case, we probably need to export anything potentially necessary, regardless if we use a random tag or not. This could be an automatic step in the post build process, using an endpoint to upload e.g. the artifacts, or a manual one for builds that are release candidates. |
@dstillman any comments on the above? |
@dstillman would it be possible to create a simple API where we could upload (and access later as needed) build artifacts for each build? |
Do not cleanup trigger tag from origin
<version>-<build>
. (Reminder, the build numbers themselves are handled by Xcode Cloud.A workflow using these script needs to have these environment variables set:
scripts/push_build
can be called to trigger an Xcode Cloud build by setting a trigger tag (not annotated, but we can change it), that decides the version bump type.Those have the format
trigger-build-bump-[patch (default)|minor|major]-<timestamp>-<random value>
.For
minor
&major
version bumps a confirmation prompt is shown.The tag is set locally, pushed to origin, and then the local tag is deleted.
The remote tag will trigger the workflow. To avoid triggering the workflow by other tags, it's configured to do so only with those that start with
trigger-build
.The remote tags are kept in the repo so that Xcode Cloud also keep the build page around. When not needed anymore, they can be delte manually or via a cleanup GitHub action, that e.g. deletes those trigger tags with timestamp older than 1 month.
In the post clone script:
In the post build script:
<version>-<build>
annotated tag is pushed to origin. It uses an environment secret that contains a GitHub Personal Access Token (PAT) URL for the repo. That limits each workflow in one repo, e.g. main org repo, or a developer fork. The reason is that it doesn't seem possible to read the primary repo URL used by the workflow. (We can probably usegit remote
to get the value, but I'll have to check if it works as expected, e.g. if there are multiple remotes.)PAT should be created by a user that has access to each repo, with the minimum allowed permissions (
public_repo
,repo:status
should be enough), but even those might be a lot. There is a newer fine-grained GitHub tokens feature, that we can try to limit it only to specific repositories, but in this case the repo owner should be the one to create each respective token.