Skip to content

Wrapper around actions/upload-artifact with extended metadata support, enabling seamless cross-workflow-run and cross-repository artifact transfers

License

Notifications You must be signed in to change notification settings

actions-rindeal/upload-artifact

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 

Repository files navigation

Upload Artifact Action

This action uploads build artifacts in your GitHub Actions workflow.

It's a wrapper around actions/upload-artifact with an additional artifact output, which is a JSON string with extended artifact metadata.

To be paired with the download-artifact action, which is again a wrapper around actions/download-artifact with an additional artifact input, that accepts the extended artifact metadata JSON string.

How is this useful?

Both actions together allow you to perform a cross-workflow-run or even cross-repository artifact transfers with just a single string being passed around.

Usage

- name: Upload artifact
  id: UPLOAD
  uses: actions-rindeal/upload-artifact@v4
  with:
    name: 'my-artifact'
# will upload `${GITHUB_WORKSPACE}/my-artifact.tar` file

Example of passing the metadata around

with:
  artifact: ${{ toJSON(fromJSON(steps.UPLOAD.outputs.ARTIFACT)) }}

Example of accessing the metadata props from Actions Expressions

env:
  ARTIFACT_NAME: ${{ fromJSON(steps.UPLOAD.outputs.ARTIFACT).name }}

Inputs

Name Description Default
name Artifact name 'artifact'
path File, directory or wildcard pattern to upload '${name}.tar'
if-no-files-found Behavior if no files are found 'warn'
retention-days Number of days before artifact expiry (0 for default retention) 0
compression-level Zlib compression level for the artifact archive '6'
overwrite Whether to overwrite an existing artifact with the same name 'false'

Outputs

Name Description Example
artifact-id The ID, usable in API '1676293972'
artifact-url The WebUI download URL 'https://github.com/org/repo/actions/runs/123/artifacts/456'
artifact JSON with metadata See below

Extended Artifact Information

The artifact output provides a JSON object with detailed information about the uploaded artifact. Here's an example:

{
  "id": 1676293972,
  "name": "my-artifact",
  "url": "https://api.github.com/repos/octo-org/octo-repo/actions/artifacts/1676293972",
  "archive_download_url": "https://api.github.com/repos/octo-org/octo-repo/actions/artifacts/1676293972/zip",
  "workflow_run": {
    "id": 9834162510,
    "repository_full_name": "octo-org/octo-repo",
    "repository_id": 1234567,
    "head_repository_id": 1234567,
    "head_branch": "master",
    "head_sha": "a9eb7e22d2c4809bf15c5beff6399ffe25f79f59"
  }
}

Notes

For more details on artifact handling in GitHub Actions, refer to the official documentation.

About

Wrapper around actions/upload-artifact with extended metadata support, enabling seamless cross-workflow-run and cross-repository artifact transfers

Topics

Resources

License

Stars

Watchers

Forks