Skip to content

β¬†οΈπŸ“¦πŸš€ Upload Artifact Action: Seamlessly upload files as build artifacts in your GitHub Actions workflow. This action extends actions/upload-artifact with additional JSON metadata output and default path settings. Perfect for cross-workflow and cross-repository artifact transfers. Boost your CI/CD efficiency now!

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

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

β¬†οΈπŸ“¦πŸš€ Upload Artifact Action

This action uploads any files as 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, and default path input set to ${INPUT_NAME}.tar.

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 easily perform cross-workflow-run or even cross-repository artifact transfers with just a single variable 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:

env:
  'ARTIFACT_NAME':  ${{ fromJSON(steps['UPLOAD'].outputs['ARTIFACT']).name }}
  'ARTIFACT_WF_ID': ${{ fromJSON(steps['UPLOAD'].outputs['ARTIFACT']).workflow_run.id }}

πŸ”§ 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

β¬†οΈπŸ“¦πŸš€ Upload Artifact Action: Seamlessly upload files as build artifacts in your GitHub Actions workflow. This action extends actions/upload-artifact with additional JSON metadata output and default path settings. Perfect for cross-workflow and cross-repository artifact transfers. Boost your CI/CD efficiency now!

Topics

Resources

License

Stars

Watchers

Forks