Skip to content

Commit

Permalink
Use more efficient workflow artifact replacement approach
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
per1234 committed Nov 5, 2024
1 parent 089a4b2 commit 2a4704a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions workflow-templates/release-go-crosscompile-task.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ jobs:
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }}
path: ${{ env.DIST_DIR }}

- name: Remove non-notarized artifact
uses: geekyeggo/delete-artifact@v5
with:
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }}

- name: Import Code-Signing Certificates
env:
KEYCHAIN: "sign.keychain"
Expand Down Expand Up @@ -192,11 +187,12 @@ jobs:
-C "${{ env.BUILD_FOLDER }}/" "${{ env.PROJECT_NAME }}" \
-C ../../ LICENSE.txt
- name: Upload notarized artifact
- name: Replace artifact with notarized build
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: ${{ env.ARTIFACT_PREFIX }}${{ matrix.build.artifact-suffix }}
overwrite: true
path: ${{ env.DIST_DIR }}/${{ env.PACKAGE_FILENAME }}

create-release:
Expand Down

0 comments on commit 2a4704a

Please sign in to comment.