{"id":18829790,"url":"https://github.com/eviden-actions/upload-artifact","last_synced_at":"2025-03-30T02:44:21.673Z","repository":{"id":198506059,"uuid":"493588395","full_name":"eviden-actions/upload-artifact","owner":"eviden-actions","description":"This uploads artifacts from your workflow allowing you to share data between jobs and store data once a workflow is complete. This action is an extension of Github's upload-artifact action that tar the files before uploading.","archived":false,"fork":false,"pushed_at":"2024-04-10T14:33:05.000Z","size":1506,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-11T03:10:31.252Z","etag":null,"topics":["actions","artifacts","eviden","github","tar","upload"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eviden-actions.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-05-18T09:07:18.000Z","updated_at":"2024-04-14T23:51:32.357Z","dependencies_parsed_at":"2023-10-25T23:27:39.757Z","dependency_job_id":"c0916491-0fa8-4395-9153-a1367731149f","html_url":"https://github.com/eviden-actions/upload-artifact","commit_stats":null,"previous_names":["eviden-actions/upload-artifact"],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eviden-actions%2Fupload-artifact","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eviden-actions%2Fupload-artifact/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eviden-actions%2Fupload-artifact/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eviden-actions%2Fupload-artifact/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eviden-actions","download_url":"https://codeload.github.com/eviden-actions/upload-artifact/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246269911,"owners_count":20750319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","artifacts","eviden","github","tar","upload"],"created_at":"2024-11-08T01:46:23.753Z","updated_at":"2025-03-30T02:44:21.648Z","avatar_url":"https://github.com/eviden-actions.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Upload-Artifact\n\nThis uploads artifacts from your workflow allowing you to share data between jobs and store data once a workflow is complete.\nThis action is an extension of Github's [upload-artifact](https://github.com/actions/upload-artifact) action that `tar` the files before uploading.\n\nSee also [download-artifact](https://github.com/eviden-actions/download-artifact).\n\n[![Release](https://github.com/eviden-actions/upload-artifact/actions/workflows/on_push.yml/badge.svg#main)](https://github.com/eviden-actions/upload-artifact/actions/workflows/on_push.yml)\n\n## v2 - What's new\n\n\u003e [!IMPORTANT]\n\u003e actions/upload-artifact@v4+ is not currently supported on GHES yet. If you are on GHES, you must use [v1](https://github.com/eviden-actions/upload-artifact/releases/tag/v1).\n\nThe release of actions/upload-artifact@v4 and actions/download-artifact@v4 are major changes to the backend architecture of Artifacts. They have numerous performance and behavioral improvements.\n\nFor more information, see the [`@actions/artifact`](https://github.com/actions/toolkit/tree/main/packages/artifact) documentation.\n\nThere is also a new sub-action, `actions/upload-artifact/merge`. For more info, check out that action's [README](./merge/README.md).\n\n### Improvements\n\n1. Uploads are significantly faster, upwards of 90% improvement in worst case scenarios.\n2. Once uploaded, an Artifact ID is returned and Artifacts are immediately available in the UI and [REST API](https://docs.github.com/en/rest/actions/artifacts). Previously, you would have to wait for the run to be completed before an ID was available or any APIs could be utilized.\n3. The contents of an Artifact are uploaded together into an _immutable_ archive. They cannot be altered by subsequent jobs unless the Artifacts are deleted and recreated (where they will have a new ID). Both of these factors help reduce the possibility of accidentally corrupting Artifact files.\n4. The compression level of an Artifact can be manually tweaked for speed or size reduction.\n\n### Breaking Changes\n\n1. On self hosted runners, additional [firewall rules](https://github.com/actions/toolkit/tree/main/packages/artifact#breaking-changes) may be required.\n2. Uploading to the same named Artifact multiple times.\n\n   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. Otherwise you _will_ encounter an error.\n\n3. Limit of Artifacts for an individual job. Each job in a workflow run now has a limit of 500 artifacts.\n\nFor assistance with breaking changes, see [MIGRATION.md](docs/MIGRATION.md).\n\n## Usage\n\n### Inputs\n\n```yaml\n- uses: actions/upload-artifact@v4\n  with:\n    # Name of the artifact to upload.\n    # Optional. Default is 'artifact'\n    name:\n\n    # A file, directory or wildcard pattern that describes what to upload\n    # Required.\n    path:\n\n    # The desired behavior if no files are found using the provided path.\n    # Available Options:\n    #   warn: Output a warning but do not fail the action\n    #   error: Fail the action with an error message\n    #   ignore: Do not output any warnings or errors, the action does not fail\n    # Optional. Default is 'warn'\n    if-no-files-found:\n\n    # Duration after which artifact will expire in days. 0 means using default retention.\n    # Minimum 1 day.\n    # Maximum 90 days unless changed from the repository settings page.\n    # Optional. Defaults to repository settings.\n    retention-days:\n\n    # The level of compression for Zlib to be applied to the artifact archive.\n    # The value can range from 0 to 9.\n    # For large files that are not easily compressed, a value of 0 is recommended for significantly faster uploads.\n    # Optional. Default is '6'\n    compression-level:\n\n    # If true, an artifact with a matching name will be deleted before a new one is uploaded.\n    # If false, the action will fail if an artifact for the given name already exists.\n    # Does not fail if the artifact does not exist.\n    # Optional. Default is 'false'\n    overwrite:\n```\n\n### Outputs\n\n| Name           | Description                                                                                                                                                                                                                                                                                   | Example                                                                     |\n| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |\n| `artifact-id`  | GitHub ID of an Artifact, can be used by the REST API                                                                                                                                                                                                                                         | `1234`                                                                      |\n| `artifact-url` | URL to download an Artifact. Can be used in many scenarios such as linking to artifacts in issues or pull requests. Users must be logged-in in order for this URL to work. This URL is valid as long as the artifact has not expired or the artifact, run or repository have not been deleted | `https://github.com/example-org/example-repo/actions/runs/1/artifacts/1234` |\n\n## Examples\n\n### Upload an Individual File\n\n```yaml\nsteps:\n  - run: mkdir -p path/to/artifact\n  - run: echo hello \u003e path/to/artifact/world.txt\n  - uses: actions/upload-artifact@v4\n    with:\n      name: my-artifact\n      path: path/to/artifact/world.txt\n```\n\n### Upload an Entire Directory\n\n```yaml\n- uses: actions/upload-artifact@v4\n  with:\n    name: my-artifact\n    path: path/to/artifact/ # or path/to/artifact\n```\n\n### Upload using a Wildcard Pattern\n\n```yaml\n- uses: actions/upload-artifact@v4\n  with:\n    name: my-artifact\n    path: path/**/[abc]rtifac?/*\n```\n\n### Upload using Multiple Paths and Exclusions\n\n```yaml\n- uses: actions/upload-artifact@v4\n  with:\n    name: my-artifact\n    path: |\n      path/output/bin/\n      path/output/test-results\n      !path/**/*.tmp\n```\n\nFor supported wildcards along with behavior and documentation, see [@actions/glob](https://github.com/actions/toolkit/tree/main/packages/glob) which is used internally to search for files.\n\nIf a wildcard pattern is used, the path hierarchy will be preserved after the first wildcard pattern:\n\n```\npath/to/*/directory/foo?.txt =\u003e\n    ∟ path/to/some/directory/foo1.txt\n    ∟ path/to/some/directory/foo2.txt\n    ∟ path/to/other/directory/foo1.txt\n\nwould be flattened and uploaded as =\u003e\n    ∟ some/directory/foo1.txt\n    ∟ some/directory/foo2.txt\n    ∟ other/directory/foo1.txt\n```\n\nIf multiple paths are provided as input, the least common ancestor of all the search paths will be used as the root directory of the artifact. Exclude paths do not affect the directory structure.\n\nRelative and absolute file paths are both allowed. Relative paths are rooted against the current working directory. Paths that begin with a wildcard character should be quoted to avoid being interpreted as YAML aliases.\n\n### Create the archive from a different directory\n\nChange to DIR before performing any tar operations.\n\nThe example below with add the folder `artifact` that is located inside the folder `path` to the archive before uploading it.\n\n```yaml\n- uses: actions/upload-artifact@v4\n  with:\n    name: my-artifact\n    path: artifact/\n    directory: path\n```\n\n### Altering compressions level (speed v. size)\n\nIf you are uploading large or easily compressable data to your artifact, you may benefit from tweaking the compression level. By default, the compression level is `6`, the same as GNU Gzip.\n\nThe value can range from 0 to 9:\n\n- 0: No compression\n- 1: Best speed\n- 6: Default compression (same as GNU Gzip)\n- 9: Best compression\n\nHigher levels will result in better compression, but will take longer to complete.\nFor large files that are not easily compressed, a value of `0` is recommended for significantly faster uploads.\n\nFor instance, if you are uploading random binary data, you can save a lot of time by opting out of compression completely, since it won't benefit:\n\n```yaml\n- name: Make a 1GB random binary file\n  run: |\n    dd if=/dev/urandom of=my-1gb-file bs=1M count=1000\n- uses: actions/upload-artifact@v4\n  with:\n    name: my-artifact\n    path: my-1gb-file\n    compression-level: 0 # no compression\n```\n\nBut, if you are uploading data that is easily compressed (like plaintext, code, etc) you can save space and cost by having a higher compression level. But this will be heavier on the CPU therefore slower to upload:\n\n```yaml\n- name: Make a file with a lot of repeated text\n  run: |\n    for i in {1..100000}; do echo -n 'foobar' \u003e\u003e foobar.txt; done\n- uses: actions/upload-artifact@v4\n  with:\n    name: my-artifact\n    path: foobar.txt\n    compression-level: 9 # maximum compression\n```\n\n### Customization if no files are found\n\nIf a path (or paths), result in no files being found for the artifact, the action will succeed but print out a warning. In certain scenarios it may be desirable to fail the action or suppress the warning. The `if-no-files-found` option allows you to customize the behavior of the action if no files are found:\n\n```yaml\n- uses: actions/upload-artifact@v4\n  with:\n    name: my-artifact\n    path: path/to/artifact/\n    if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`\n```\n\n### (Not) Uploading to the same artifact\n\nUnlike earlier versions of `upload-artifact`, uploading to the same artifact via multiple jobs is _not_ supported with `v4`.\n\n```yaml\n- run: echo hi \u003e world.txt\n- uses: actions/upload-artifact@v4\n  with:\n    # implicitly named as 'artifact'\n    path: world.txt\n\n- run: echo howdy \u003e extra-file.txt\n- uses: actions/upload-artifact@v4\n  with:\n    # also implicitly named as 'artifact', will fail here!\n    path: extra-file.txt\n```\n\nArtifact names must be unique since each created artifact is idempotent so multiple jobs cannot modify the same artifact.\n\nIn matrix scenarios, be careful to not accidentally upload to the same artifact, or else you will encounter conflict errors. It would be best to name the artifact _with_ a prefix or suffix from the matrix:\n\n```yaml\njobs:\n  upload:\n    name: Generate Build Artifacts\n\n    strategy:\n      matrix:\n        os: [ubuntu-latest, windows-latest]\n        version: [a, b, c]\n\n    runs-on: ${{ matrix.os }}\n\n    steps:\n      - name: Build\n        run: ./some-script --version=${{ matrix.version }} \u003e my-binary\n      - name: Upload\n        uses: actions/upload-artifact@v4\n        with:\n          name: binary-${{ matrix.os }}-${{ matrix.version }}\n          path: my-binary\n```\n\nThis will result in artifacts like: `binary-ubuntu-latest-a`, `binary-windows-latest-b`, and so on.\n\nPreviously the behavior _allowed_ for the artifact names to be the same which resulted in unexpected mutations and accidental corruption. Artifacts created by upload-artifact@v4 are immutable.\n\n### Environment Variables and Tilde Expansion\n\nYou can use `~` in the path input as a substitute for `$HOME`. Basic tilde expansion is supported:\n\n```yaml\n- run: |\n    mkdir -p ~/new/artifact\n    echo hello \u003e ~/new/artifact/world.txt\n- uses: actions/upload-artifact@v4\n  with:\n    name: my-artifacts\n    path: ~/new/**/*\n```\n\nEnvironment variables along with context expressions can also be used for input. For documentation see [context and expression syntax](https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions):\n\n```yaml\nenv:\n  name: my-artifact\nsteps:\n  - run: |\n      mkdir -p ${{ github.workspace }}/artifact\n      echo hello \u003e ${{ github.workspace }}/artifact/world.txt\n  - uses: actions/upload-artifact@v4\n    with:\n      name: ${{ env.name }}-name\n      path: ${{ github.workspace }}/artifact/**/*\n```\n\nFor environment variables created in other steps, make sure to use the `env` expression syntax\n\n```yaml\nsteps:\n  - run: |\n      mkdir testing\n      echo \"This is a file to upload\" \u003e testing/file.txt\n      echo \"artifactPath=testing/file.txt\" \u003e\u003e $GITHUB_ENV\n  - uses: actions/upload-artifact@v4\n    with:\n      name: artifact\n      path: ${{ env.artifactPath }} # this will resolve to testing/file.txt at runtime\n```\n\n### Retention Period\n\nArtifacts are retained for 90 days by default. You can specify a shorter retention period using the `retention-days` input:\n\n```yaml\n- name: Create a file\n  run: echo \"I won't live long\" \u003e my_file.txt\n\n- name: Upload Artifact\n  uses: actions/upload-artifact@v4\n  with:\n    name: my-artifact\n    path: my_file.txt\n    retention-days: 5\n```\n\nThe retention period must be between 1 and 90 inclusive. For more information see [artifact and log retention policies](https://docs.github.com/en/free-pro-team@latest/actions/reference/usage-limits-billing-and-administration#artifact-and-log-retention-policy).\n\n### Using Outputs\n\nIf an artifact upload is successful then an `artifact-id` output is available. This ID is a unique identifier that can be used with [Artifact REST APIs](https://docs.github.com/en/rest/actions/artifacts).\n\n#### Example output between steps\n\n```yml\n- uses: actions/upload-artifact@v4\n  id: artifact-upload-step\n  with:\n    name: my-artifact\n    path: path/to/artifact/content/\n\n- name: Output artifact ID\n  run: echo 'Artifact ID is ${{ steps.artifact-upload-step.outputs.artifact-id }}'\n```\n\n#### Example output between jobs\n\n```yml\njobs:\n  job1:\n    runs-on: ubuntu-latest\n    outputs:\n      output1: ${{ steps.artifact-upload-step.outputs.artifact-id }}\n    steps:\n      - uses: actions/upload-artifact@v4\n        id: artifact-upload-step\n        with:\n          name: my-artifact\n          path: path/to/artifact/content/\n  job2:\n    runs-on: ubuntu-latest\n    needs: job1\n    steps:\n      - env:\n          OUTPUT1: ${{needs.job1.outputs.output1}}\n        run: echo \"Artifact ID from previous job is $OUTPUT1\"\n```\n\n### Overwriting an Artifact\n\nAlthough it's not possible to mutate an Artifact, can completely overwrite one. But do note that this will give the Artifact a new ID, the previous one will no longer exist:\n\n```yaml\njobs:\n  upload:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Create a file\n        run: echo \"hello world\" \u003e my-file.txt\n      - name: Upload Artifact\n        uses: actions/upload-artifact@v4\n        with:\n          name: my-artifact # NOTE: same artifact name\n          path: my-file.txt\n  upload-again:\n    needs: upload\n    runs-on: ubuntu-latest\n    steps:\n      - name: Create a different file\n        run: echo \"goodbye world\" \u003e my-file.txt\n      - name: Upload Artifact\n        uses: actions/upload-artifact@v4\n        with:\n          name: my-artifact # NOTE: same artifact name\n          path: my-file.txt\n          overwrite: true\n```\n\n## Limitations\n\n### Number of Artifacts\n\nWithin an individual job, there is a limit of 500 artifacts that can be created for that job.\n\nYou may also be limited by Artifacts if you have exceeded your shared storage quota. Storage is calculated every 6-12 hours. See [the documentation](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#calculating-minute-and-storage-spending) for more info.\n\n### Zip archives\n\nWhen an Artifact is uploaded, all the files are assembled into an immutable Zip archive. There is currently no way to download artifacts in a format other than a Zip or to download individual artifact contents.\n\n### Permission Loss\n\nFile permissions are not maintained during artifact upload. All directories will have `755` and all files will have `644`. For example, if you make a file executable using `chmod` and then upload that file, post-download the file is no longer guaranteed to be set as an executable.\n\nIf you must preserve permissions, you can `tar` all of your files together before artifact upload. Post download, the `tar` file will maintain file permissions and case sensitivity.\n\n```yaml\n- name: 'Tar files'\n  run: tar -cvf my_files.tar /path/to/my/directory\n\n- name: 'Upload Artifact'\n  uses: actions/upload-artifact@v4\n  with:\n    name: my-artifact\n    path: my_files.tar\n```\n\n## Where does the upload go?\n\nAt the bottom of the workflow summary page, there is a dedicated section for artifacts. Here's a screenshot of something you might see:\n\n\u003cimg src=\"https://user-images.githubusercontent.com/16109154/103645952-223c6880-4f59-11eb-8268-8dca6937b5f9.png\" width=\"700\" height=\"300\"\u003e\n\nThere is a trashcan icon that can be used to delete the artifact. This icon will only appear for users who have write permissions to the repository.\n\nThe size of the artifact is denoted in bytes. The displayed artifact size denotes the size of the zip that `upload-artifact` creates during upload.\n\n## Additional Documentation\n\nSee [Github's upload-artifact action](https://github.com/actions/upload-artifact) for additional documentation.\nSee [Storing workflow data as artifacts](https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts) for additional examples and tips.\n\nSee extra documentation for the [@actions/artifact](https://github.com/actions/toolkit/blob/main/packages/artifact/docs/additional-information.md) package that is used internally regarding certain behaviors and limitations.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feviden-actions%2Fupload-artifact","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feviden-actions%2Fupload-artifact","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feviden-actions%2Fupload-artifact/lists"}