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

Use more efficient workflow artifact replacement approach #529

Merged
merged 2 commits into from
Nov 6, 2024

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Nov 6, 2024

The "Release" workflow (Go, Task, Crosscompile) template uses a GitHub Actions workflow to automatically generate releases of a project. This is done for a range of host architectures, including macOS. The macOS builds are then put through a notarization process in a dedicated workflow job.

The builds are transferred between jobs by GitHub Actions workflow artifacts. The create-release-artifacts job produces macOS workflow artifacts containing non-notarized builds, which must then be replaced after the builds are notarized by the notarize-macos job.

Previously, the approach chosen to accomplish this replacement was to use the community created geekyeggo/delete-artifact action to delete each artifact after it had been downloaded by the notarize-macos job, then replacing it by uploading the notarized version using the actions/upload-artifact action. It turns out that the ability to overwrite workflows was recently added to the actions/upload-artifact action, in 4.2.0: actions/upload-artifact@11ff42c. This behavior is enabled by setting the action's overwrite input to true. By using this feature, the dependence on the geekyeggo/delete-artifact action can be avoided, making the workflow more simple, easier to maintain, and more secure.

The established convention is to pad the GitHub Actions context identifier in references.

In this workflow code, the right hand padding was missing.
The "Release" workflow (Go, Task, Crosscompile) template uses a GitHub Workflow to automatically generate releases of a
project. This is done for a range of host architectures, including macOS. The macOS builds are then put through a
notarization process in a dedicated workflow job.

The builds are transferred between jobs by GitHub Actions workflow artifacts. The "create-release-artifacts" job
produces macOS workflow artifacts containing non-notarized builds, which must then be replaced after the builds are
notarized by the "notarize-macos" job.

Previously, the approach chosen to accomplish this replacement was to use the community created
"geekyeggo/delete-artifact" action to delete each artifact after it had been downloaded by the "notarize-macos" job,
then replacing it by uploading the notarized version using the "actions/upload-artifact" action. It turns out that the
ability to overwrite workflows was recently added to the "actions/upload-artifact" action. This behavior is enabled by
setting the action's `overwrite` input to `true`. By using this feature, the dependence on the
"geekyeggo/delete-artifact" action can be avoided, making the workflow more simple, easier to maintain, and more secure.
@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Nov 6, 2024
@per1234 per1234 self-assigned this Nov 6, 2024
@per1234 per1234 merged commit 4e7a852 into arduino:main Nov 6, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant