Skip to content
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

Automate signed pkg build for macOS App Store submission #2624

Merged
merged 3 commits into from
Jul 21, 2024

Conversation

danryu
Copy link
Contributor

@danryu danryu commented May 9, 2022

This PR adds automation to create a signed pkg (installer) file for direct submission to the macOS App Store, and then submits that signed installer to Apple App Store Connect (macOS Testflight) to allow it to be selected for App Store release.

CHANGELOG: adds macOS signed pkg build automation

Context: automates building of signed pkg file for macOS App Store

Does this change need documentation? What needs to be documented and how?

Required:

  1. In Apple Developer Account, create the following resources in in https://developer.apple.com/account/resources/certificates/list
  • Certificates:

    • Mac Installer Distribution
    • Mac App Distribution
  • Identifier:

    • app ID (bundleID)
  1. Add the certs to Github Secrets as per https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development

Status of this Pull Request

What is missing until this pull request can be merged?

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

.github/autobuild/mac.sh Outdated Show resolved Hide resolved
Copy link
Member

@ann0see ann0see left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very interesting ;-). I think only @emlynmac can really comment here.

.github/autobuild/mac.sh Outdated Show resolved Hide resolved
.github/autobuild/mac.sh Outdated Show resolved Hide resolved
.github/autobuild/mac.sh Outdated Show resolved Hide resolved
mac/deploy_mac.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@emlynmac emlynmac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to make this work along side the ad-hoc signing.
The changes here will break the existing signing set up.
Ad hoc requires:

  • Signing
  • Notarizing
  • Stapling the package when notarization complete

App Store distribution requires

  • Signing (with a different certificate)
  • Packaging
  • Installer signing (with an installer certificate)
  • Validation
  • Upload

I'd like to see the App Store target work along side the existing ad-hoc signing steps.

.github/autobuild/mac.sh Outdated Show resolved Hide resolved
.github/autobuild/mac.sh Outdated Show resolved Hide resolved
mac/deploy_mac.sh Outdated Show resolved Hide resolved
@danryu
Copy link
Contributor Author

danryu commented May 10, 2022

@emlynmac @ann0see I've updated to reflect your comments.
Let me know what you think of the cert naming so far.
Now doing some testing and looking at validate+upload with altool.

@ann0see
Copy link
Member

ann0see commented May 15, 2022

Good to hear!
@emlynmac Should test it on his repo

@danryu
Copy link
Contributor Author

danryu commented May 16, 2022

Good to hear! @emlynmac Should test it on his repo

Yes sure, and from the build checks above it looks like it works transparently when signing deps are not satisfied.

As I noted in the iOS PR #2625 the build now attempts to validate and upload to App Store using altool - and may fail when eg re-attempting the same version upload.

@ann0see ann0see marked this pull request as draft May 27, 2022 21:03
@ann0see
Copy link
Member

ann0see commented Jun 8, 2022

@emlynmac any news?

@gilgongo gilgongo added this to Triage in Tracking (old) via automation Jul 2, 2022
@gilgongo gilgongo moved this from Triage to Waiting Externally in Tracking (old) Jul 2, 2022
@pljones pljones moved this from Waiting Externally to Triage in Tracking (old) Oct 5, 2022
@danryu danryu changed the title Draft: automate signed pkg build for macOS App Store submission Automate signed pkg build for macOS App Store submission Oct 11, 2022
@danryu danryu marked this pull request as ready for review October 11, 2022 12:37
@danryu
Copy link
Contributor Author

danryu commented Nov 6, 2022

Updated with the necessary logic to validate and upload the signed macOS "pkg" installer to the Mac App Store when the necessary conditions are met (I thought I had already done this!)

Copy link
Member

@ann0see ann0see left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably it's close to get in. It of course raises the questions when/if we deploy a cert in our repo.

.github/autobuild/mac.sh Outdated Show resolved Hide resolved
.github/autobuild/mac.sh Outdated Show resolved Hide resolved
.github/autobuild/mac.sh Outdated Show resolved Hide resolved
.github/workflows/autobuild.yml Outdated Show resolved Hide resolved
mac/deploy_mac.sh Outdated Show resolved Hide resolved
@danryu
Copy link
Contributor Author

danryu commented Nov 7, 2022

Probably it's close to get in. It of course raises the questions when/if we deploy a cert in our repo.

The cert stuff is obviously most easily handled by whoever already has the App Store Connect account for Jamulus. I don't think the certs are any more sensitive than the existing auth details you are already using for dmg file Notarization (appstore-connect-username,appstore-connect-password ).

@ann0see
Copy link
Member

ann0see commented Nov 7, 2022

Fair point. Emlyn owns the cert for now and not many people have push access to his repo.

@danryu
Copy link
Contributor Author

danryu commented Nov 7, 2022

When/if he gets round to it Emlyn will have to create the 2 new certificates and follow the guides as mentioned in the description. Apple doesn't make this easy enough IMO - too much downloading certificates, importing to keychain manager, exporting as p12 then base64 encoding - for each cert. It's a pain.

@ann0see ann0see moved this from Triage to In Progress in Tracking (old) Nov 7, 2022
@ann0see ann0see changed the base branch from master to main December 26, 2022 19:08
@ann0see
Copy link
Member

ann0see commented May 3, 2023

@danryu could you please rebase this PR?

I think fixing the app store alongside signing isn't an unsolvable issue (check if app store cert is present --> if not skip modifications)

@danryu
Copy link
Contributor Author

danryu commented May 4, 2023

@ann0see Yes, can do. I'll need a few days at least to review things.

@ann0see ann0see moved this from In Progress to Triage in Tracking (old) Jul 1, 2023
@ann0see
Copy link
Member

ann0see commented Jul 1, 2023

@danryu any updates?

@danryu
Copy link
Contributor Author

danryu commented Jul 2, 2023

@danryu any updates?

Sorry, hit a very busy period. I managed to take a look today but the rebase appeared problematic, so I've gone with a merge - hope that's ok. Looks like there might be some style check failures still, at least.

@ann0see
Copy link
Member

ann0see commented Jul 2, 2023

Ok. Thanks.

Merging makes it a lot more difficult to get right later - but I hope we can figure it out. Fixing the styling should be possible

@pljones pljones removed this from Triage in Tracking (old) Jul 28, 2023
@danryu
Copy link
Contributor Author

danryu commented Aug 5, 2023

Coding style checks now fixed

@ann0see
Copy link
Member

ann0see commented Aug 5, 2023

Great! Thanks. Maybe this gets ready for 3.11.0 (next release, not this one)

@ann0see
Copy link
Member

ann0see commented Jul 17, 2024

Force push works with git push --force?

@danryu
Copy link
Contributor Author

danryu commented Jul 17, 2024

Force push works with git push --force?

Not to my branch, no.

jamulus % git push koord-live macos_sign --force
Everything up-to-date

I haven't attempted this kind of force push before, is this not expected?

@ann0see
Copy link
Member

ann0see commented Jul 17, 2024

Maybe you're on the wrong local branch? Check what commits git log show.

@softins
Copy link
Member

softins commented Jul 17, 2024

Force push works with git push --force?

Not to my branch, no.

jamulus % git push koord-live macos_sign --force
Everything up-to-date

I haven't attempted this kind of force push before, is this not expected?

It's because your koord-live/koord-app-compat fork of jamulussoftware/jamulus is not up to date with jamulus itself. For example, you still have the master branch, dated 10 Oct 2022. The master branch has been deprecated since then, and replaced with main, which I can't see in your fork.

I see you have a copy of my macos-sign-squash branch in your repo. That does therefore include all the commits up to the recent main, but your repo doesn't know that they are.

I'm happy to help, but that probably needs to be done interactively. What messaging method do you prefer? Do you have Discord? What time zone are you in?

@danryu
Copy link
Contributor Author

danryu commented Jul 17, 2024

I see you have a copy of my macos-sign-squash branch in your repo. That does therefore include all the commits up to the recent main, but your repo doesn't know that they are.

Thanks, I think that the divergence between branches makes this a bit too much overhead to be worthwhile. That was a temporary branch at the time and I'd rather just dump it at this point.

I just have a single commit to make - if you can give me permissions to push to your branch softins:macos-sign-squash then I can update there.
I know we'll need to re-open #3309 - sorry, I thought this was gonna be easier.

@ann0see
Copy link
Member

ann0see commented Jul 17, 2024

Just copy and paste the changes of the commit here.

You can use a git patch https://devconnected.com/how-to-create-and-apply-git-patch-files/

@danryu
Copy link
Contributor Author

danryu commented Jul 17, 2024

Thanks, I couldn't get git format-patch to produce anything, so I used git diff directly.

logic_separate.patch

@danryu
Copy link
Contributor Author

danryu commented Jul 18, 2024

@softins I also pushed the update to https://github.com/koord-live/koord-app-compat/tree/appstore2 if you just want to pull that?

FWIW, what steps would be required to update my fork? I pushed the upstream main branch but that didn't help. Just curious :)

@softins
Copy link
Member

softins commented Jul 18, 2024

@danryu thanks! I have a busy day today (UK time), but will hopefully get to it later. I'll also answer your question about updating too.

@softins
Copy link
Member

softins commented Jul 18, 2024

@danryu I linked your repo as an additional remote, and I found your differ branch which was based off my macos-sign-squash with just your recent changes for optional app store submission. Those changes look good, thanks! I've updated my branch to include that commit too.

So we can either merge my branch via #3309, or your could reset your macos_sign branch to point to differ and force push it to this PR. To do that, you would do this:

# switch to the macos_sign branch
git checkout macos_sign
# keep a pointer to the old branch for reference (does not switch to it)
git branch macos_sign_old
# reset the macos_sign branch pointer to point to the commit at the head of differ
git reset --hard differ
# update the remote github branch with force
git push --force

I see you now have the up to date main branch now too. Excellent!

@danryu
Copy link
Contributor Author

danryu commented Jul 19, 2024

@softins Thanks, I went with your instructions (I hadn't thought to do the git reset previously!)

Unfortunately the macOS build breaks at the dmg creation stage - possibly related to this (intermittent?) error?
actions/runner-images#7522

PS I didn't make any changes to this part, so I think my changes are working correctly (thus far)

@softins
Copy link
Member

softins commented Jul 20, 2024

@softins Thanks, I went with your instructions (I hadn't thought to do the git reset previously!)

Great, all looks good to me.

Unfortunately the macOS build breaks at the dmg creation stage - possibly related to this (intermittent?) error? actions/runner-images#7522

Yes, hdiutil: create failed - Resource busy crops up from time to time. Re-running the workflows normally works. I'll try that.

PS I didn't make any changes to this part, so I think my changes are working correctly (thus far)

Cool. I'll set this PR as "Ready for review" instead of "Draft" and will close my #3309 in favour of this one.

@softins softins marked this pull request as ready for review July 20, 2024 09:31
@softins
Copy link
Member

softins commented Jul 20, 2024

Yes, hdiutil: create failed - Resource busy crops up from time to time. Re-running the workflows normally works. I'll try that.

Yes, re-running succeeded for all platforms.

Copy link
Member

@softins softins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is ok now. Let's get it merged and deal with anything that might occur when we try signing and/or submitting.

.github/autobuild/mac.sh Outdated Show resolved Hide resolved
.github/autobuild/mac.sh Outdated Show resolved Hide resolved
@softins
Copy link
Member

softins commented Jul 20, 2024

This PR doesn't appear to allow pushes from project maintainers (I tried), so we rely on @danryu applying suggested changes.

.github/autobuild/mac.sh Outdated Show resolved Hide resolved
@danryu
Copy link
Contributor Author

danryu commented Jul 21, 2024

Thanks, I've applied the changes as suggested (I think the for loop was a leftover from an earlier iteration, so it was good to remove that!)
Hopefully we're all done now :)

@ann0see
Copy link
Member

ann0see commented Jul 21, 2024

Before us merging, please squash the commits into one: e.g via git rebase -i. Then select to squash all commits in the editor.

@pljones pljones added the tooling Changes to the automated build system label Jul 21, 2024
@pljones pljones added this to the Release 3.11.0 milestone Jul 21, 2024
@pljones
Copy link
Collaborator

pljones commented Jul 21, 2024

I'd like all the "Outdated" but still not "Resolved" comments marked resolved, if they have been, too, please.

@softins softins dismissed ann0see’s stale review July 21, 2024 17:23

Changes were done as requested

@ann0see ann0see merged commit dc29ab0 into jamulussoftware:main Jul 21, 2024
15 checks passed
@ann0see
Copy link
Member

ann0see commented Jul 21, 2024

Ok. Squash merged. Not ideal, but the PR ID shows up.

Thanks all for waiting this long!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tooling Changes to the automated build system
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants