Skip to content

Automate Podspec deployment with Github action #829

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

Closed
SebastianThiebaud opened this issue Jun 8, 2020 · 12 comments
Closed

Automate Podspec deployment with Github action #829

SebastianThiebaud opened this issue Jun 8, 2020 · 12 comments
Labels
cocoapods Relates to CocoaPods kind/enhancement Improvements to existing feature.

Comments

@SebastianThiebaud
Copy link
Contributor

SebastianThiebaud commented Jun 8, 2020

Is your feature request related to a problem? Please describe it.

Everytime a new release is created, it can take hours before the associated podspec is published to Cocoapods.

Describe the solution you'd like

Instead of manually pushing the podspec to Cocoapods, a Github action could take care of running any required scripts, stamp / bump the version of the podspec to match the new release tag and publish the new podspec to Cocoapods once a new release is created/published.

@SebastianThiebaud SebastianThiebaud added kind/enhancement Improvements to existing feature. nio labels Jun 8, 2020
@Jake-Prickett
Copy link
Contributor

I really like this idea! I’ve been trying to work through how to do this as well, but haven’t thought of an elegant solution. (Also at my work project) I’d love some help on this one! 🙂

The biggest challenge for this is that the Pods (CGRPCZlib and gRPC-Swift) have to be pushed in a specific order for them to pass validation. The time required for CGRPCZlib to become available after pushing to trunk can vary from seconds to minutes. This requires the script to sometimes be ran multiple times manually.

It could be retried with some sort of delay, but there’s no guarantee that it’s available that second run (could even be a build issue or actual validation failure)

@SebastianThiebaud
Copy link
Contributor Author

SebastianThiebaud commented Jun 9, 2020

I can definitely help on this one as I've implemented a similar solution at my work. The only difference is that the Github action I wrote is pushing to a private specs repository rather than the main Cocoapods trunk. There are plenty of actions available already doing the job of pushing the podspec to Cocoapods, we can see if using them works for grpc-swift.

Concerning CGRPCZlib, it seems like we would have to implement a similar action on that repository. But then, we might run into an issue when a grpc-swift release is created before the new CGRPCZlib podspec is published and available. @Jake-Prickett Do you know why the podspec in not immediately available? I've never seen this happening for my own projects.

And if the push of the grpc-swift fails because the CGRPCZlib dependency is not available, we would get alerted by email and we could retry manually, but still not ideal.

@Jake-Prickett
Copy link
Contributor

Jake-Prickett commented Jun 9, 2020

Both the CGRPCZlib and gRPC-Swift are part of this repo and are pushed sequentially to Trunk. Trunk defaults to use the CDN instead of the Git repository, which takes some time to reflect updates to Podspecs. (Up to 10 minutes)

The issue is properly described here: CocoaPods/CocoaPods#9497

But it looks like a fix was merged in last month!! 🎉 CocoaPods/cocoapods-trunk#147 We could add —synchronous to build_podspec.py when we push to Trunk to resolve that issue.

Now this problem just got much easier! 😂

@SebastianThiebaud
Copy link
Contributor Author

SebastianThiebaud commented Jun 9, 2020

Amazing! Okay, I'll push a pull request either tonight.

@SebastianThiebaud
Copy link
Contributor Author

@Jake-Prickett The only thing I forgot to mention is that the .podspec files in the repositories won't have the latest version number committed in master. We can discuss about that in the pull request once I submit.

@Jake-Prickett
Copy link
Contributor

Nice! @glbrntt @MrMage - what’re your thoughts?

@SebastianThiebaud
Copy link
Contributor Author

Now that I'm thinking, we could just not host the podspec files, generate them during the Github action, push them to Cocoapods and that's it. I don't think Cocoapods requires to host the files in the repository, right?

@glbrntt
Copy link
Collaborator

glbrntt commented Jun 9, 2020

I'm hugely on board with this issue!

I don't think Cocoapods requires to host the files in the repository, right?

I think you're right and I'm okay with not having them in the repo, I think @MrMage has an opinion on this though?

@MrMage
Copy link
Collaborator

MrMage commented Jun 9, 2020

Overall, I like the idea. A few points:

  • I would prefer to have the Podspec in the repo, because that makes it easier to review them/look them up manually (e.g. when I want to check what the current deps of the Pod are). GitHub Actions might be able to automatically commit the change, though.
  • This might require storing a CocoaPods session in the repo's secrets; how should we solve that?

@SebastianThiebaud
Copy link
Contributor Author

PS: Can we get the alpha 13 released to Cocoapods? :)

@SebastianThiebaud
Copy link
Contributor Author

SebastianThiebaud commented Jun 10, 2020

@MrMage Here is what I think could work to get the CocoaPods session token:

  • Create a new Gmail account (for example [email protected])
  • Enable Gmail API on this account
  • I will write a Github action that:
    • Register a new session pod trunk register [email protected] "gRPC Swift"
    • Fetch Gmail API:
      • Github secret GMAIL_CREDENTIALS will be needed (this is the json data downloadable once the API is enabled)
      • App will auth with the Gmail API to get a token
      • App will fetch the last email from [email protected] or retry every X seconds until the email is received
      • App will parse the email body and create a request with the embedded Cocoapods link to confirm the new session
  • Then, we can proceed to build the podspecs and push them

@glbrntt glbrntt added the cocoapods Relates to CocoaPods label Jun 26, 2020
@glbrntt glbrntt removed the nio label Jul 6, 2020
@glbrntt
Copy link
Collaborator

glbrntt commented Apr 30, 2025

Cocoapods haven't been supported by this project since 2022, closing.

@glbrntt glbrntt closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cocoapods Relates to CocoaPods kind/enhancement Improvements to existing feature.
Projects
None yet
Development

No branches or pull requests

4 participants