Home > Article > Development Tools > how to publish artifact in github actions
In GitHub Actions, artifacts enable sharing data among workflow jobs. Using the upload-artifact action, users can publish a single artifact with name and path parameters, while for multiple artifacts, they can utilize the upload-artifacts action spec
How to publish artifact in github actions?
Yes, you can publish artifacts in GitHub Actions. To publish an artifact, you can use the upload-artifact
action. The syntax for the upload-artifact
action is as follows:
<code class="yaml">- uses: actions/upload-artifact@v2 with: name: artifact-name path: path-to-artifact</code>
For example, the following code publishes an artifact named my-artifact
with the contents of the dist
directory:
<code class="yaml">- uses: actions/upload-artifact@v2 with: name: my-artifact path: dist</code>
How to publish multiple artifacts in github actions?
To publish multiple artifacts in GitHub Actions, you can use the upload-artifacts
action. The syntax for the upload-artifacts
action is as follows:
<code class="yaml">- uses: actions/upload-artifacts@v2 with: artifacts: artifact-paths</code>
For example, the following code publishes two artifacts, my-artifact1
and my-artifact2
:
<code class="yaml">- uses: actions/upload-artifacts@v2 with: artifacts: dist/my-artifact1.zip,dist/my-artifact2.zip</code>
Can you publish artifacts in github actions?
Yes, you can publish artifacts in GitHub Actions. To publish an artifact, you can use the upload-artifact
action or the upload-artifacts
action.
The above is the detailed content of how to publish artifact in github actions. For more information, please follow other related articles on the PHP Chinese website!