URL to latest.tar.gz

WordPress provides a direct URL for latest.tar.gz, which is easy to remember when needed.
Does CP have one or plan to have one? This would be different from /latest Github link.

Ex: https://wordpress.org/latest.tar.gz

It would make it easy to use with WP-CLI install command.

Thanks.

2 Likes

I think the easiest way to make this work would be to write a PHP script that uses the GitHub API to fetch a list of releases, pick the latest release, and redirect to the current download. Here’s the API endpoint to use: https://api.github.com/repos/ClassicPress/ClassicPress-release/releases

A .zip file would work just as well, or the script could support both.

If you or anyone else are willing to help with this, we’d appreciate it. This code can live at https://github.com/ClassicPress/ClassicPress-Network, much like the script in the join-slack directory.

Please be sure to set appropriate cache control headers in this script, and CloudFlare will cache the results for us as described here. Otherwise, we will quickly exhaust the rate limit for GitHub API calls. An expiration time of around 15 minutes should be sufficient.

1 Like

So it would be an index.php file inside a directory, like slack example? I might throw this on my developer’s to-do list, should be pretty easy.

1 Like

Yes, I think so. We’d probably have to write a server configuration rule to direct latest.zip and latest.tar.gz to the script, but we can do that.

Ok. Forgot to ask, should this be submitted as pull request to that repo?

Yes please.

:+1: .

Hey @james, I’m coming back to this. Just wanted to confirm, was this implemented in any way yet? Before I get on this, thought I confirm.

3 Likes

Thanks for asking @viktor, I forgot about this thread!

Just a few days ago I implemented https://www.classicpress.net/latest.zip and a few other URLs. See: https://github.com/ClassicPress/ClassicPress-Network/issues/52 for details.

I did it a bit differently, re-using existing code that was already on the site, which was much easier than the approach I suggested above.

Note - because that URL just redirects to the latest release zip on GitHub, you’ll get a file named ClassicPress-release-1.1.2.zip if you click it in a browser. When unzipped, it contains a single folder named ClassicPress-release-1.1.2 and that version number will change with each new version. This is easy enough to script for, and WP-CLI can handle it too.

I also wrote a change for WP-CLI that lets you install a zip file directly from a URL, so as long as you’re using WP-CLI 2.4.0 or higher (currently the latest release), wp core download https://www.classicpress.net/latest.zip will work as expected.

Is the .zip URL enough for your needs or should we go ahead and add the .tar.gz URL too?

7 Likes

Thanks @james. Glad I asked :slightly_smiling_face: Zip file is enough for our use. I will test it.

2 Likes