-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add a workflow that builds and publishes a release via GitHub Actions #1908
Conversation
Thanks for the PR attempt. I didn't have a chance to run it but noticed a few things. First off, to clarify my aversion for using GitHub's artifact zip tool and using ditto instead, see eg actions/upload-artifact#37 which apparently you have already noticed before :) However if you use The Distribution target invokes to We haven't made the decision to drop the non-xcframework variant so we may still need to provide it.. although, it might make sense to, because there's some redundancy here in packaging both versions. Unfortunately though the xcframework variant for SPM needs to be a The last hurdle (from #1751) which I'm now just realizing.. is that when |
Yeah, I hadn't accounted for the double-zip bug in
That's fine - no problem at all. I'll add the framework variant back.
Not a problem - providing the frameworks compressed as both zip and a gzipped tape archive are fine 👌🏻 Maybe we could shift it over the bzip2 or lzma and potentially save even more space?
Yeah, this will be tricky. Ideally, the CI user has no ability to change the repo it is building from, but this is definitely a problem. I'll give it some thought, but the obvious (but perhaps not great) answer is to let the workflow calculate that checksum and update the package manifest in the repo directly (ie, follow through on the non-CI script and then push the changes back). I wonder how other projects are handling this? |
9099b8c
to
c5308cb
Compare
Ok, I've updated the workflow to not use artefacts at all, and to publish both the .tar.xz and the .zip. It will now also push the moved tag back up to the server. |
Do you know what Xcode version is being used? In the pull request CI workflow we specify it by specifying the If I understand right, we will need to commit/push a tag we want first before running this workflow, so there will be a small window where the tag pushed is wrong. Is there any way to pass the tag we want as a parameter so we can just push the tag remotely once..? Otherwise this may be an acceptable consequence. (let's start with tagging In make-release-package.sh we still likely need to change make-release-package.sh currently uses a dummy git tag when ran in CI. It will need to use the actual tag now.. See the comments in #1751 (comment) about unit tests failing. Because we specify
We used to use bzip2 I think, Kornel has experimented around with better compression.. SPM binary packages enforces us to use zip though as far as I know. |
Thanks for writing this by the way, this can potentially save us lot of work, if it works!
@kornelski feel free to give Tony access to test this and iron out issues. It may save us work and we should create a beta 1 tag anyway =) |
There is also cocoa pods but I think we should just do that push manually, and (..maybe..) ignore it for beta versions. The important bit is that |
I feel like after we've automated the releases via GH Actions, there are probably a number of other things we can rationalise and improve.
Yes, we could make it a manual workflow that you execute directly and provide a string as the tag. Initially, someone would then need to go in and fill in the release notes, etc - but all of that could be automated. Reading the changelog into the release is feasible, so long as it's kept up-to-date pretty religiously. Let's get this working as a manual workflow to start with, and then we can talk through improving it so that nobody needs to be doing any builds or uploads from their personal machines. |
It's actually fine - if you predefine the
Whatever the default is - I believe it's Xcode 12.5.1 on GitHub Actions right now. For building releases, I feel like this is probably the right call, but yes, it should be locked so that we're not automatically updated to Xcode 13 when it becomes the default. |
Curious how you pass an input in the drafts page, but neat that this is possible. Some things I mentioned above and creating tasks:
|
It's not happening on the drafts page. I believe the process is that you go to the "Actions" tab, and then select the "Create Draft Release" workflow - there should be a button in the detail of that page that allows you to trigger the workflow, and that is where the input field for this value will be. The workflow will then build all of the binary bits, and make a very basic draft release that you can then visit to tag and publish. Long story short, the tag isn't created at all as part of this workflow - it won't be created until you publish the draft release that the workflow creates. This gives you the opportunity to attach release notes and double-check that the binaries are OK before making it final. It does make me wonder if maybe we should be using input value to populate the |
This sounds good and reasonable.
I think we will need to pass an input for the CURRENT_TAG_NAME or something. The CURRENT_PROJECT_VERSION needs to be equal to it, or a CURRENT_TAG_NAME needs to have a prefix "$CURRENT_PROJECT_VERSION-" in case of prerelease identifiers (CURRENT_PROJECT_VERSION which is used for bundle versions shouldn't include prerelease identifier info) We would then need to read the current tag name we pass, instead of trying to fetch the latest tag on disk as you say, to:
(or pass in the project version and the optional prerelease identifier as two different input fields and we update the current project version..) The draft template should probably output the tag name we used somewhere so we can copy and paste, or prefill the tag field if possible. |
What we could consider doing is allowing the input of a value into the workflow that can be in SemVer format, ie: 2.0.0-beta.1, and use a script to strip off the prerelease information from that when it is set in the bundle. So the tag would be correct ( This does raise questions in my mind, though… I've always used a monotonically increasing integer for the How do we resolve this? It's fine to mark a build as pre-release on GitHub, but betas and the like should be clearly marked as thus in their metadata/Info.plist. How has this been handled for Sparkle in the past? I'd like to be consistent with the project's standards, if they're not broken. |
Sparkle has a post install script (set-git-version-info.sh) that modifies the short version string on the framework and various bundles to be the current project version ($CURRENT_PROJECT_VERSION) appended by the tag/hash information (after the first dash from In my opinion the CFBundleVersion and CURRENT_PROJECT_VERSION should not include pre-release info, leave it to the short version string which will show up when you get info in Finder. For 2.x's entire lifespan so far, the CFBundleVersion has basically never changed, but the CFBundleShortVersionString has meaningfully been updated on every commit. The apple docs may say you shouldn't include prerelease info in the (localizable..) short version string, but I would really not worry about that too much, and it's less important for a framework bundle versus an app (versus an App Store app on App Store Connect) IMO.
This could be a reasonable approach for updating the CURRENT_PROJECT_VERSION in the project config. Or we could more manually require the CURRENT_PROJECT_VERSION to be updated beforehand when we need to update the CHANGELOG manually. |
For my own projects, I use the result of the following as my git rev-list --count HEAD | sed -e 's/^[ \t]*//' This produces an integer that increases on every commit to the current branch. If we run this against Sparkle's 2.x branch right now, it produces a build of Thoughts? |
That seems less valuable than the I think we need to maintain the current display version and base project version. So my first thought would be in our ConfigCommon.xcconfig file doing:
I'll think more about this. |
Could I inject an argument that the CURRENT_PROJECT_VERSION should increase over time with each build? I know it's not that big a deal for a framework to have incorrect details on disk, but it sets a bad example for the wider community who do need to increase this value over time. They'll potentially look at examples like this and follow them. Ultimately, I'll follow whatever guidance you give here, but I felt like I needed to inject this. Also, the project should probably switch to using |
I think I'm ok with something like this:
I don't care to update a monotonically increasing bundle version on every commit, only on releases that we tag; this is a proper approach that apps take during development. So basically this is an edge case for beta releases we may publish soon. I also don't want to add more to our post install scripts (I'd more like to remove them but alas we need the set-git-version info one at least to ensure the XPC Services / frameworks are aligned on a commit level). If we publish a release locally (I want to keep this workflow working as a fallback), we can manually update the project version; we'd have to update the marketing version and CHANGELOG alongside anyway. It's not necessary to depend on git to increment the counter (can read current value and write value + 1). However, if it's easier that way, then I don't see why not. The set git version info script will still be needed as well as the counter/short git hash it outputs, which is a more reliable indicator to see if things are aligned or what build a user has. There's a chance making this change will break the SPUXPCValidateServiceIfBundleExists() function and set-get-version-info.sh formatting for pre-releases, so those likely will need to be updated. This workflow will still need to pass the tag name we'll want to create to set-get-version-info.sh - it currently assumes we create the tag beforehand. edit: updated again; we should indeed include pre-release suffix in marketing version macro |
You're absolutely right: for simple projects, the count of the rev list is fine, but it's not reliable - especially if there is ever an intent to go back and release patch updates to older releases, or if you're branching all over the place. It sounds to me that sticking with a manual versioning approach works better for how this project currently runs? That's fine - we can just leave all of that out of the GitHub Actions workflow, and version details will be the responsibility of the developer, not CI. I've updated the Actions workflow to extract the marketing version to use as the draft tag, and the name of the draft release on Github, so that it all needs to be setup in the repo beforehand. The workflow won't ask for the tag details, as those should already be available in the repo.
I've updated the script to extract the commit hash properly, even with a prerelease suffix present. Was there more in Sorry, I know this is dragging on - I'm keen to get it right. |
I think this sounds fine and reasonable.
Let me review other parts of the PR first and then I can address the logic there (based on what we end up doing aside from this).. |
This wouldn’t have included the correct version.
352422b
to
dc7fbbd
Compare
Ok, I've applied the requested patches, and I think I've covered the issues you've raised. I apologise for taking so long, and for the shoddy work in the middle there - I've got three children under the age of 10 homeschooling during a lockdown, so things are pretty chaotic. Thanks for being patient. |
I've also rebased onto the latest code from the 2.x branch so the PR should apply cleanly. |
Just had two small comments, one of them about the ditto extraction, otherwise looks good to me (barring from testing the github workflow). There's no rush on this on our end. |
3825858
to
45b97c5
Compare
Thank you. Changes look good to me although I have not tried the workflow (and it seems like it would be more productive to have changes merged first to try it out). There are also some good project versioning changes here with having the CURRENT_PROJECT_VERSION being an increasing number, and MARKETING_VERSION as what we want to market, as well as making updating the Package.swift and cocoa pods spec files consistent. I'll give a chance @kornelski to take a look, otherwise I'll just end up merging this. I won't get to trying the workflow myself until maybe the weekend although you are free to try; I'll invite you to the project. We will first need a PR that bumps the marketing version to 2.0.0-beta.1 (and current project version too consequently) though. |
From a quick read-through of the changes, everything seems ok (and even improved!) on the SPM front |
Thanks for taking a second look! 🎉. |
This PR proposes to add a new GitHub Actions workflow that will build a release version of Sparkle, and publish it to a draft release on GitHub.
The workflow can be triggered manually from the Actions tab.
This is an initial implementation of this workflow. Future iterations can (and should):
I've no way of testing this properly, so someone from the core team will probably need to take what I've done here, try it and fix any issues that arise when they are doing the first Sparkle 2.x prerelease.
I'm also not sure if there's more that we need to publish here - I can see that there are separate frameworks published for SPM in v1.x. Please feel free to comment or review and I'll add anything I've missed here.
Addresses #1883.