Homebrew / actions

🚀 Homebrew's GitHub Actions
BSD 2-Clause "Simplified" License
118 stars 39 forks source link

Support Actions Artifacts v2 (i.e. upload-artifact v4) #475

Closed Bo98 closed 5 months ago

Bo98 commented 9 months ago

Notable breaking change for the way we deal with bottles, that will require changes in multiple workflows and repositories:

Uploading to the same named Artifact multiple times.

Due to how Artifacts are created in this new version, it is no longer possible to upload to the same named Artifact multiple times. You must either split the uploads into multiple Artifacts with different names, or only upload once.

There's also some improvements that may make some things easier like:

Once uploaded, an Artifact ID is returned and Artifacts are immediately available in the UI and REST API. Previously, you would have to wait for the run to be completed before an ID was available or any APIs could be utilized.

Artifacts can now be downloaded and deleted from the UI before the entire workflow run finishes.

There was some difficulties we had with bottle caching and reruns that may have been solved here.

We can also probably deprecate Homebrew/actions/download-artifact:

This library (and actions/download-artifact) now support downloading Artifacts from other repositories and runs if a GITHUB_TOKEN with sufficient actions:read permissions are provided.

Worth noting however when we make the change that when switching to actions/download-artifact@v4:

Downloading artifacts that were created from action/upload-artifact@v3 and below are not supported.

This means we should probably do the switch at a time when a bunch of PRs aren't pending approval as all of them will need rebasing.


There will likely also be a GitHub blog post about all this soon.

These partially overlap in information, but all three are worth reading:

MikeMcQuaid commented 9 months ago

Thanks @Bo98, good reads. Anything relevant to more basic uses like e.g. formulae.brew.sh we should know about (other than: you'll need to upgrade both actions at once)?

Bo98 commented 9 months ago

Should all be okay there I think.

Only scenario which is a problem is any workflow that uploads to the same artifact name in multiple jobs, e.g. each OS/arch in Homebrew-core uploads to a single "bottle" artifact. This setup no longer works. Workflows using a matrix is usually where you see this.

Things here in Homebrew/actions may be used under such environments by Homebrew/core etc so anything here could also be affected.

carlocab commented 7 months ago

I think migration should be fairly straightforward (at least for Homebrew/core) given changes in the newer versions of upload/download-artifact: https://github.com/actions/upload-artifact/issues/472#issuecomment-1861571655

Bo98 commented 7 months ago

We don't always use download-artifact directly (except dispatch-* workflows), but we could similarly add a pattern feature to pr-pull.