mirror of
https://code.forgejo.org/forgejo/upload-artifact
synced 2026-09-07 08:21:46 -04:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9653d03c4b | ||
|
|
875b630764 | ||
|
|
ecb21463e9 | ||
|
|
5e7604f84a | ||
|
|
d6437d0758 | ||
|
|
1b56155703 | ||
|
|
6a5077f99b | ||
|
|
2a6c27a029 | ||
|
|
9a179cdb8d | ||
|
|
eba2a242da |
@@ -10,9 +10,11 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
paths-ignore:
|
||||||
- main
|
- '**.md'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -20,33 +22,32 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node 16
|
- name: Setup Node 20
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 20.x
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Move the committed index.js file
|
- name: Rebuild the dist/ directory
|
||||||
run: mv dist/index.js /tmp
|
|
||||||
|
|
||||||
- name: Rebuild with tsc
|
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Rebuild the index.js file
|
- name: Compare the expected and actual dist/ directories
|
||||||
run: npm run release
|
run: |
|
||||||
|
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
|
||||||
- name: Compare the expected and actual index.js files
|
echo "Detected uncommitted changes after build. See status below:"
|
||||||
run: git diff --ignore-all-space dist/index.js /tmp/index.js
|
git diff
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
id: diff
|
id: diff
|
||||||
|
|
||||||
# If index.js was different than expected, upload the expected version as an artifact
|
# If index.js was different than expected, upload the expected version as an artifact
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4-beta
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||||
with:
|
with:
|
||||||
name: index.js
|
name: dist
|
||||||
path: dist/index.js
|
path: dist/
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Check licenses
|
name: Check licenses
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- name: Install licensed
|
- name: Install licensed
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
+17
-44
@@ -1,4 +1,5 @@
|
|||||||
name: Test
|
name: Test
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -10,7 +11,6 @@ on:
|
|||||||
- '**.md'
|
- '**.md'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
|
|
||||||
@@ -23,12 +23,12 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup Node 16
|
- name: Setup Node 20
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 20.x
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
@@ -54,33 +54,26 @@ jobs:
|
|||||||
mkdir -p path/to/dir-3
|
mkdir -p path/to/dir-3
|
||||||
echo "Lorem ipsum dolor sit amet" > path/to/dir-1/file1.txt
|
echo "Lorem ipsum dolor sit amet" > path/to/dir-1/file1.txt
|
||||||
echo "Hello world from file #2" > path/to/dir-2/file2.txt
|
echo "Hello world from file #2" > path/to/dir-2/file2.txt
|
||||||
echo "This is a going to be a test for a large enough file that should get compressed with GZip. The @actions/artifact package uses GZip to upload files. This text should have a compression ratio greater than 100% so it should get uploaded using GZip" > path/to/dir-3/gzip.txt
|
|
||||||
|
|
||||||
# Upload a single file artifact
|
# Upload a single file artifact
|
||||||
- name: 'Upload artifact #1'
|
- name: 'Upload artifact #1'
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
name: 'Artifact-A'
|
name: 'Artifact-A-${{ matrix.runs-on }}'
|
||||||
path: path/to/dir-1/file1.txt
|
path: path/to/dir-1/file1.txt
|
||||||
|
|
||||||
# Upload using a wildcard pattern, name should default to 'artifact' if not provided
|
# Upload using a wildcard pattern
|
||||||
- name: 'Upload artifact #2'
|
- name: 'Upload artifact #2'
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
name: 'Artifact-Wildcard-${{ matrix.runs-on }}'
|
||||||
path: path/**/dir*/
|
path: path/**/dir*/
|
||||||
|
|
||||||
# Upload a directory that contains a file that will be uploaded with GZip
|
# Upload a multi-path artifact
|
||||||
- name: 'Upload artifact #3'
|
- name: 'Upload artifact #3'
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
name: 'GZip-Artifact'
|
name: 'Multi-Path-Artifact-${{ matrix.runs-on }}'
|
||||||
path: path/to/dir-3/
|
|
||||||
|
|
||||||
# Upload a directory that contains a file that will be uploaded with GZip
|
|
||||||
- name: 'Upload artifact #4'
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
name: 'Multi-Path-Artifact'
|
|
||||||
path: |
|
path: |
|
||||||
path/to/dir-1/*
|
path/to/dir-1/*
|
||||||
path/to/dir-[23]/*
|
path/to/dir-[23]/*
|
||||||
@@ -88,9 +81,9 @@ jobs:
|
|||||||
|
|
||||||
# Download Artifact #1 and verify the correctness of the content
|
# Download Artifact #1 and verify the correctness of the content
|
||||||
- name: 'Download artifact #1'
|
- name: 'Download artifact #1'
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4-beta
|
||||||
with:
|
with:
|
||||||
name: 'Artifact-A'
|
name: 'Artifact-A-${{ matrix.runs-on }}'
|
||||||
path: some/new/path
|
path: some/new/path
|
||||||
|
|
||||||
- name: 'Verify Artifact #1'
|
- name: 'Verify Artifact #1'
|
||||||
@@ -108,9 +101,9 @@ jobs:
|
|||||||
|
|
||||||
# Download Artifact #2 and verify the correctness of the content
|
# Download Artifact #2 and verify the correctness of the content
|
||||||
- name: 'Download artifact #2'
|
- name: 'Download artifact #2'
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4-beta
|
||||||
with:
|
with:
|
||||||
name: 'artifact'
|
name: 'Artifact-Wildcard-${{ matrix.runs-on }}'
|
||||||
path: some/other/path
|
path: some/other/path
|
||||||
|
|
||||||
- name: 'Verify Artifact #2'
|
- name: 'Verify Artifact #2'
|
||||||
@@ -127,31 +120,11 @@ jobs:
|
|||||||
}
|
}
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
# Download Artifact #3 and verify the correctness of the content
|
# Download Artifact #4 and verify the correctness of the content
|
||||||
- name: 'Download artifact #3'
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
name: 'GZip-Artifact'
|
|
||||||
path: gzip/artifact/path
|
|
||||||
|
|
||||||
# Because a directory was used as input during the upload the parent directories, path/to/dir-3/, should not be included in the uploaded artifact
|
|
||||||
- name: 'Verify Artifact #3'
|
|
||||||
run: |
|
|
||||||
$gzipFile = "gzip/artifact/path/gzip.txt"
|
|
||||||
if(!(Test-Path -path $gzipFile))
|
|
||||||
{
|
|
||||||
Write-Error "Expected file do not exist"
|
|
||||||
}
|
|
||||||
if(!((Get-Content $gzipFile) -ceq "This is a going to be a test for a large enough file that should get compressed with GZip. The @actions/artifact package uses GZip to upload files. This text should have a compression ratio greater than 100% so it should get uploaded using GZip"))
|
|
||||||
{
|
|
||||||
Write-Error "File contents of downloaded artifact is incorrect"
|
|
||||||
}
|
|
||||||
shell: pwsh
|
|
||||||
|
|
||||||
- name: 'Download artifact #4'
|
- name: 'Download artifact #4'
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v4-beta
|
||||||
with:
|
with:
|
||||||
name: 'Multi-Path-Artifact'
|
name: 'Multi-Path-Artifact-${{ matrix.runs-on }}'
|
||||||
path: multi/artifact
|
path: multi/artifact
|
||||||
|
|
||||||
- name: 'Verify Artifact #4'
|
- name: 'Verify Artifact #4'
|
||||||
|
|||||||
@@ -1,34 +1,112 @@
|
|||||||
# Upload-Artifact v4 beta
|
# `@actions/upload-artifact`
|
||||||
|
|
||||||
❗ Not publicly available. If you try to use this version then it will fail. Available only internally at GitHub while in development. Stay tuned for public announcements soon about broader availability❗
|
Upload [Actions Artifacts](https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts) from your Workflow Runs. Internally powered by [@actions/artifact](https://github.com/actions/toolkit/tree/main/packages/artifact) package.
|
||||||
|
|
||||||
This uploads artifacts from your workflow allowing you to share data between jobs and store data once a workflow is complete.
|
|
||||||
|
|
||||||
See also [download-artifact](https://github.com/actions/download-artifact).
|
See also [download-artifact](https://github.com/actions/download-artifact).
|
||||||
|
|
||||||
# What's new
|
- [`@actions/upload-artifact`](#actionsupload-artifact)
|
||||||
|
- [v4 - What's new](#v4---whats-new)
|
||||||
|
- [Improvements](#improvements)
|
||||||
|
- [Breaking Changes](#breaking-changes)
|
||||||
|
- [Usage](#usage)
|
||||||
|
- [Inputs](#inputs)
|
||||||
|
- [Outputs](#outputs)
|
||||||
|
- [Examples](#examples)
|
||||||
|
- [Upload an Individual File](#upload-an-individual-file)
|
||||||
|
- [Upload an Entire Directory](#upload-an-entire-directory)
|
||||||
|
- [Upload using a Wildcard Pattern](#upload-using-a-wildcard-pattern)
|
||||||
|
- [Upload using Multiple Paths and Exclusions](#upload-using-multiple-paths-and-exclusions)
|
||||||
|
- [Altering compressions level (speed v. size)](#altering-compressions-level-speed-v-size)
|
||||||
|
- [Customization if no files are found](#customization-if-no-files-are-found)
|
||||||
|
- [(Not) Uploading to the same artifact](#not-uploading-to-the-same-artifact)
|
||||||
|
- [Environment Variables and Tilde Expansion](#environment-variables-and-tilde-expansion)
|
||||||
|
- [Retention Period](#retention-period)
|
||||||
|
- [Using Outputs](#using-outputs)
|
||||||
|
- [Example output between steps](#example-output-between-steps)
|
||||||
|
- [Example output between jobs](#example-output-between-jobs)
|
||||||
|
- [Limitations](#limitations)
|
||||||
|
- [Number of Artifacts](#number-of-artifacts)
|
||||||
|
- [Zip archives](#zip-archives)
|
||||||
|
- [Permission Loss](#permission-loss)
|
||||||
|
- [Where does the upload go?](#where-does-the-upload-go)
|
||||||
|
|
||||||
🚧 Under construction 🚧
|
|
||||||
|
|
||||||
Big changes coming...
|
## v4 - What's new
|
||||||
|
|
||||||
Refer [here](https://github.com/actions/upload-artifact/tree/releases/v3) for the previous version
|
> [!IMPORTANT]
|
||||||
|
> upload-artifact@v4+ is not currently supported on GHES yet. If you are on GHES, you must use [v3](https://github.com/actions/upload-artifact/releases/tag/v3).
|
||||||
|
|
||||||
# Usage
|
The release of upload-artifact@v4 and download-artifact@v4 are major changes to the backend architecture of Artifacts. They have numerous performance and behavioral improvements.
|
||||||
|
|
||||||
See [action.yml](action.yml)
|
For more information, see the [`@actions/artifact`](https://github.com/actions/toolkit/tree/main/packages/artifact) documentation.
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
|
||||||
|
1. Uploads are significantly faster, upwards of 90% improvement in worst case scenarios.
|
||||||
|
2. 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.
|
||||||
|
3. The contents of an Artifact are uploaded together into an _immutable_ archive. They cannot be altered by subsequent jobs. Both of these factors help reduce the possibility of accidentally corrupting Artifact files.
|
||||||
|
4. The compression level of an Artifact can be manually tweaked for speed or size reduction.
|
||||||
|
|
||||||
|
### Breaking Changes
|
||||||
|
|
||||||
|
1. On self hosted runners, additional [firewall rules](https://github.com/actions/toolkit/tree/main/packages/artifact#breaking-changes) may be required.
|
||||||
|
2. Uploading to the same named Artifact multiple times.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
3. Limit of Artifacts for an individual job. Each job in a workflow run now has a limit of 10 artifacts.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Inputs
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
# Name of the artifact to upload.
|
||||||
|
# Optional. Default is 'artifact'
|
||||||
|
name:
|
||||||
|
|
||||||
|
# A file, directory or wildcard pattern that describes what to upload
|
||||||
|
# Required.
|
||||||
|
path:
|
||||||
|
|
||||||
|
# The desired behavior if no files are found using the provided path.
|
||||||
|
# Available Options:
|
||||||
|
# warn: Output a warning but do not fail the action
|
||||||
|
# error: Fail the action with an error message
|
||||||
|
# ignore: Do not output any warnings or errors, the action does not fail
|
||||||
|
# Optional. Default is 'warn'
|
||||||
|
if-no-files-found:
|
||||||
|
|
||||||
|
# Duration after which artifact will expire in days. 0 means using default retention.
|
||||||
|
# Minimum 1 day.
|
||||||
|
# Maximum 90 days unless changed from the repository settings page.
|
||||||
|
# Optional. Defaults to repository settings.
|
||||||
|
retention-days:
|
||||||
|
|
||||||
|
# The level of compression for Zlib to be applied to the artifact archive.
|
||||||
|
# The value can range from 0 to 9.
|
||||||
|
# For large files that are not easily compressed, a value of 0 is recommended for significantly faster uploads.
|
||||||
|
# Optional. Default is '6'
|
||||||
|
compression-level:
|
||||||
|
```
|
||||||
|
|
||||||
|
### Outputs
|
||||||
|
|
||||||
|
| Name | Description | Example |
|
||||||
|
| - | - | - |
|
||||||
|
| `artifact-id` | GitHub ID of an Artifact, can be used by the REST API | `1234` |
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
### Upload an Individual File
|
### Upload an Individual File
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- run: mkdir -p path/to/artifact
|
- run: mkdir -p path/to/artifact
|
||||||
|
|
||||||
- run: echo hello > path/to/artifact/world.txt
|
- run: echo hello > path/to/artifact/world.txt
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
- uses: actions/upload-artifact@v4-beta
|
|
||||||
with:
|
with:
|
||||||
name: my-artifact
|
name: my-artifact
|
||||||
path: path/to/artifact/world.txt
|
path: path/to/artifact/world.txt
|
||||||
@@ -37,7 +115,7 @@ steps:
|
|||||||
### Upload an Entire Directory
|
### Upload an Entire Directory
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/upload-artifact@v4-beta
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: my-artifact
|
name: my-artifact
|
||||||
path: path/to/artifact/ # or path/to/artifact
|
path: path/to/artifact/ # or path/to/artifact
|
||||||
@@ -46,7 +124,7 @@ steps:
|
|||||||
### Upload using a Wildcard Pattern
|
### Upload using a Wildcard Pattern
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/upload-artifact@v4-beta
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: my-artifact
|
name: my-artifact
|
||||||
path: path/**/[abc]rtifac?/*
|
path: path/**/[abc]rtifac?/*
|
||||||
@@ -55,7 +133,7 @@ steps:
|
|||||||
### Upload using Multiple Paths and Exclusions
|
### Upload using Multiple Paths and Exclusions
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/upload-artifact@v4-beta
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: my-artifact
|
name: my-artifact
|
||||||
path: |
|
path: |
|
||||||
@@ -84,62 +162,105 @@ If multiple paths are provided as input, the least common ancestor of all the se
|
|||||||
|
|
||||||
Relative 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.
|
Relative 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.
|
||||||
|
|
||||||
The [@actions/artifact](https://github.com/actions/toolkit/tree/main/packages/artifact) package is used internally to handle most of the logic around uploading an artifact. There is extra documentation around upload limitations and behavior in the toolkit repo that is worth checking out.
|
### Altering compressions level (speed v. size)
|
||||||
|
|
||||||
|
If 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.
|
||||||
|
|
||||||
|
The value can range from 0 to 9:
|
||||||
|
- 0: No compression
|
||||||
|
- 1: Best speed
|
||||||
|
- 6: Default compression (same as GNU Gzip)
|
||||||
|
- 9: Best compression
|
||||||
|
|
||||||
|
Higher levels will result in better compression, but will take longer to complete.
|
||||||
|
For large files that are not easily compressed, a value of `0` is recommended for significantly faster uploads.
|
||||||
|
|
||||||
|
For 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:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Make a 1GB random binary file
|
||||||
|
run: |
|
||||||
|
dd if=/dev/urandom of=my-1gb-file bs=1M count=1000
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: my-artifact
|
||||||
|
path: my-1gb-file
|
||||||
|
compression-level: 0 # no compression
|
||||||
|
```
|
||||||
|
|
||||||
|
But, 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:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: Make a file with a lot of repeated text
|
||||||
|
run: |
|
||||||
|
for i in {1..100000}; do echo -n 'foobar' >> foobar.txt; done
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: my-artifact
|
||||||
|
path: foobar.txt
|
||||||
|
compression-level: 9 # maximum compression
|
||||||
|
```
|
||||||
|
|
||||||
### Customization if no files are found
|
### Customization if no files are found
|
||||||
|
|
||||||
If 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:
|
If 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:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/upload-artifact@v4-beta
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: my-artifact
|
name: my-artifact
|
||||||
path: path/to/artifact/
|
path: path/to/artifact/
|
||||||
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
|
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
|
||||||
```
|
```
|
||||||
|
|
||||||
### Conditional Artifact Upload
|
### (Not) Uploading to the same artifact
|
||||||
|
|
||||||
To upload artifacts only when the previous step of a job failed, use [`if: failure()`](https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions#job-status-check-functions):
|
Unlike earlier versions of `upload-artifact`, uploading to the same artifact via multiple jobs is _not_ supported with `v4`.
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: actions/upload-artifact@v4-beta
|
|
||||||
if: failure()
|
|
||||||
with:
|
|
||||||
name: my-artifact
|
|
||||||
path: path/to/artifact/
|
|
||||||
```
|
|
||||||
|
|
||||||
### Uploading without an artifact name
|
|
||||||
|
|
||||||
You can upload an artifact without specifying a name
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: actions/upload-artifact@v4-beta
|
|
||||||
with:
|
|
||||||
path: path/to/artifact/world.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
If not provided, `artifact` will be used as the default name which will manifest itself in the UI after upload.
|
|
||||||
|
|
||||||
### Uploading to the same artifact
|
|
||||||
|
|
||||||
Unlike earlier versions of `upload-artifact`, uploading to the same artifact via multiple jobs is _not_ supported with `v4`.
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- run: echo hi > world.txt
|
- run: echo hi > world.txt
|
||||||
- uses: actions/upload-artifact@v4-beta
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
# implicitly named as 'artifact'
|
||||||
path: world.txt
|
path: world.txt
|
||||||
|
|
||||||
- run: echo howdy > extra-file.txt
|
- run: echo howdy > extra-file.txt
|
||||||
- uses: actions/upload-artifact@v4-beta
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
# also implicitly named as 'artifact', will fail here!
|
||||||
path: extra-file.txt
|
path: extra-file.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
Artifact names must be unique since each created artifact is idempotent so multiple jobs cannot modify the same artifact.
|
Artifact names must be unique since each created artifact is idempotent so multiple jobs cannot modify the same artifact.
|
||||||
|
|
||||||
|
In 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:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
upload:
|
||||||
|
name: Generate Build Artifacts
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-latest, windows-latest]
|
||||||
|
version: [a, b, c]
|
||||||
|
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Build
|
||||||
|
run: ./some-script --version=${{ matrix.version }} > my-binary
|
||||||
|
- name: Upload
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: binary-${{ matrix.os }}-${{ matrix.version }}
|
||||||
|
path: my-binary
|
||||||
|
```
|
||||||
|
|
||||||
|
This will result in artifacts like: `binary-ubuntu-latest-a`, `binary-windows-latest-b`, and so on.
|
||||||
|
|
||||||
|
Previously 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.
|
||||||
|
|
||||||
### Environment Variables and Tilde Expansion
|
### Environment Variables and Tilde Expansion
|
||||||
|
|
||||||
You can use `~` in the path input as a substitute for `$HOME`. Basic tilde expansion is supported:
|
You can use `~` in the path input as a substitute for `$HOME`. Basic tilde expansion is supported:
|
||||||
@@ -148,7 +269,7 @@ You can use `~` in the path input as a substitute for `$HOME`. Basic tilde expan
|
|||||||
- run: |
|
- run: |
|
||||||
mkdir -p ~/new/artifact
|
mkdir -p ~/new/artifact
|
||||||
echo hello > ~/new/artifact/world.txt
|
echo hello > ~/new/artifact/world.txt
|
||||||
- uses: actions/upload-artifact@v4-beta
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: Artifacts-V4-beta
|
name: Artifacts-V4-beta
|
||||||
path: ~/new/**/*
|
path: ~/new/**/*
|
||||||
@@ -163,7 +284,7 @@ Environment variables along with context expressions can also be used for input.
|
|||||||
- run: |
|
- run: |
|
||||||
mkdir -p ${{ github.workspace }}/artifact
|
mkdir -p ${{ github.workspace }}/artifact
|
||||||
echo hello > ${{ github.workspace }}/artifact/world.txt
|
echo hello > ${{ github.workspace }}/artifact/world.txt
|
||||||
- uses: actions/upload-artifact@v4-beta
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ env.name }}-name
|
name: ${{ env.name }}-name
|
||||||
path: ${{ github.workspace }}/artifact/**/*
|
path: ${{ github.workspace }}/artifact/**/*
|
||||||
@@ -173,11 +294,11 @@ For environment variables created in other steps, make sure to use the `env` exp
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- run: |
|
- run: |
|
||||||
mkdir testing
|
mkdir testing
|
||||||
echo "This is a file to upload" > testing/file.txt
|
echo "This is a file to upload" > testing/file.txt
|
||||||
echo "artifactPath=testing/file.txt" >> $GITHUB_ENV
|
echo "artifactPath=testing/file.txt" >> $GITHUB_ENV
|
||||||
- uses: actions/upload-artifact@v4-beta
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: artifact
|
name: artifact
|
||||||
path: ${{ env.artifactPath }} # this will resolve to testing/file.txt at runtime
|
path: ${{ env.artifactPath }} # this will resolve to testing/file.txt at runtime
|
||||||
@@ -192,7 +313,7 @@ Artifacts are retained for 90 days by default. You can specify a shorter retenti
|
|||||||
run: echo "I won't live long" > my_file.txt
|
run: echo "I won't live long" > my_file.txt
|
||||||
|
|
||||||
- name: Upload Artifact
|
- name: Upload Artifact
|
||||||
uses: actions/upload-artifact@v4-beta
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: my-artifact
|
name: my-artifact
|
||||||
path: my_file.txt
|
path: my_file.txt
|
||||||
@@ -201,14 +322,14 @@ Artifacts are retained for 90 days by default. You can specify a shorter retenti
|
|||||||
|
|
||||||
The 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).
|
The 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).
|
||||||
|
|
||||||
## Outputs
|
### Using Outputs
|
||||||
|
|
||||||
If 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).
|
If 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).
|
||||||
|
|
||||||
### Example output between steps
|
#### Example output between steps
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
- uses: actions/upload-artifact@v4-beta
|
- uses: actions/upload-artifact@v4
|
||||||
id: artifact-upload-step
|
id: artifact-upload-step
|
||||||
with:
|
with:
|
||||||
name: my-artifact
|
name: my-artifact
|
||||||
@@ -218,7 +339,7 @@ If an artifact upload is successful then an `artifact-id` output is available. T
|
|||||||
run: echo 'Artifact ID is ${{ steps.artifact-upload-step.outputs.artifact-id }}'
|
run: echo 'Artifact ID is ${{ steps.artifact-upload-step.outputs.artifact-id }}'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Example output between jobs
|
#### Example output between jobs
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
jobs:
|
jobs:
|
||||||
@@ -227,7 +348,7 @@ jobs:
|
|||||||
outputs:
|
outputs:
|
||||||
output1: ${{ steps.my-artifact.outputs.artifact-id }}
|
output1: ${{ steps.my-artifact.outputs.artifact-id }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/upload-artifact@v4-beta
|
- uses: actions/upload-artifact@v4
|
||||||
id: artifact-upload-step
|
id: artifact-upload-step
|
||||||
with:
|
with:
|
||||||
name: my-artifact
|
name: my-artifact
|
||||||
@@ -241,6 +362,35 @@ jobs:
|
|||||||
run: echo "Artifact ID from previous job is $OUTPUT1"
|
run: echo "Artifact ID from previous job is $OUTPUT1"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Limitations
|
||||||
|
|
||||||
|
### Number of Artifacts
|
||||||
|
|
||||||
|
Within an individual job, there is a limit of 10 artifacts that can be created for that job.
|
||||||
|
|
||||||
|
You 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.
|
||||||
|
|
||||||
|
### Zip archives
|
||||||
|
|
||||||
|
When 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.
|
||||||
|
|
||||||
|
### Permission Loss
|
||||||
|
|
||||||
|
File 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.
|
||||||
|
|
||||||
|
If 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.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
- name: 'Tar files'
|
||||||
|
run: tar -cvf my_files.tar /path/to/my/directory
|
||||||
|
|
||||||
|
- name: 'Upload Artifact'
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: my-artifact
|
||||||
|
path: my_files.tar
|
||||||
|
```
|
||||||
|
|
||||||
## Where does the upload go?
|
## Where does the upload go?
|
||||||
|
|
||||||
At the bottom of the workflow summary page, there is a dedicated section for artifacts. Here's a screenshot of something you might see:
|
At the bottom of the workflow summary page, there is a dedicated section for artifacts. Here's a screenshot of something you might see:
|
||||||
@@ -250,13 +400,3 @@ At the bottom of the workflow summary page, there is a dedicated section for art
|
|||||||
There 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.
|
There 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.
|
||||||
|
|
||||||
The size of the artifact is denoted in bytes. The displayed artifact size denotes the size of the zip that `upload-artifact` creates during upload.
|
The size of the artifact is denoted in bytes. The displayed artifact size denotes the size of the zip that `upload-artifact` creates during upload.
|
||||||
|
|
||||||
## Additional Documentation
|
|
||||||
|
|
||||||
See [Storing workflow data as artifacts](https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts) for additional examples and tips.
|
|
||||||
|
|
||||||
See 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.
|
|
||||||
|
|
||||||
# License
|
|
||||||
|
|
||||||
The scripts and documentation in this project are released under the [MIT License](LICENSE).
|
|
||||||
|
|||||||
Vendored
+114
-142
@@ -3153,16 +3153,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|||||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.create = void 0;
|
|
||||||
const client_1 = __nccwpck_require__(23955);
|
const client_1 = __nccwpck_require__(23955);
|
||||||
/**
|
|
||||||
* Exported functionality that we want to expose for any users of @actions/artifact
|
|
||||||
*/
|
|
||||||
__exportStar(__nccwpck_require__(2538), exports);
|
__exportStar(__nccwpck_require__(2538), exports);
|
||||||
function create() {
|
__exportStar(__nccwpck_require__(69398), exports);
|
||||||
return client_1.Client.create();
|
__exportStar(__nccwpck_require__(23955), exports);
|
||||||
}
|
const client = new client_1.DefaultArtifactClient();
|
||||||
exports.create = create;
|
exports["default"] = client;
|
||||||
//# sourceMappingURL=artifact.js.map
|
//# sourceMappingURL=artifact.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@@ -4998,32 +4994,24 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|||||||
return t;
|
return t;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.Client = void 0;
|
exports.DefaultArtifactClient = void 0;
|
||||||
const core_1 = __nccwpck_require__(66526);
|
const core_1 = __nccwpck_require__(66526);
|
||||||
const config_1 = __nccwpck_require__(95042);
|
const config_1 = __nccwpck_require__(95042);
|
||||||
const upload_artifact_1 = __nccwpck_require__(86278);
|
const upload_artifact_1 = __nccwpck_require__(86278);
|
||||||
const download_artifact_1 = __nccwpck_require__(17306);
|
const download_artifact_1 = __nccwpck_require__(17306);
|
||||||
const get_artifact_1 = __nccwpck_require__(56218);
|
const get_artifact_1 = __nccwpck_require__(56218);
|
||||||
const list_artifacts_1 = __nccwpck_require__(64033);
|
const list_artifacts_1 = __nccwpck_require__(64033);
|
||||||
class Client {
|
const errors_1 = __nccwpck_require__(69398);
|
||||||
/**
|
/**
|
||||||
* Constructs a Client
|
* The default artifact client that is used by the artifact action(s).
|
||||||
*/
|
*/
|
||||||
static create() {
|
class DefaultArtifactClient {
|
||||||
return new Client();
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Upload Artifact
|
|
||||||
*/
|
|
||||||
uploadArtifact(name, files, rootDirectory, options) {
|
uploadArtifact(name, files, rootDirectory, options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if ((0, config_1.isGhes)()) {
|
|
||||||
(0, core_1.warning)(`@actions/artifact v2.0.0+ and upload-artifact@v4+ are not currently supported on GHES.`);
|
|
||||||
return {
|
|
||||||
success: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
|
if ((0, config_1.isGhes)()) {
|
||||||
|
throw new errors_1.GHESNotSupportedError();
|
||||||
|
}
|
||||||
return (0, upload_artifact_1.uploadArtifact)(name, files, rootDirectory, options);
|
return (0, upload_artifact_1.uploadArtifact)(name, files, rootDirectory, options);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
@@ -5032,24 +5020,16 @@ class Client {
|
|||||||
Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information.
|
Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information.
|
||||||
|
|
||||||
If the error persists, please check whether Actions is operating normally at [https://githubstatus.com](https://www.githubstatus.com).`);
|
If the error persists, please check whether Actions is operating normally at [https://githubstatus.com](https://www.githubstatus.com).`);
|
||||||
return {
|
throw error;
|
||||||
success: false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Download Artifact
|
|
||||||
*/
|
|
||||||
downloadArtifact(artifactId, options) {
|
downloadArtifact(artifactId, options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if ((0, config_1.isGhes)()) {
|
|
||||||
(0, core_1.warning)(`@actions/artifact v2.0.0+ and download-artifact@v4+ are not currently supported on GHES.`);
|
|
||||||
return {
|
|
||||||
success: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
|
if ((0, config_1.isGhes)()) {
|
||||||
|
throw new errors_1.GHESNotSupportedError();
|
||||||
|
}
|
||||||
if (options === null || options === void 0 ? void 0 : options.findBy) {
|
if (options === null || options === void 0 ? void 0 : options.findBy) {
|
||||||
const { findBy: { repositoryOwner, repositoryName, token } } = options, downloadOptions = __rest(options, ["findBy"]);
|
const { findBy: { repositoryOwner, repositoryName, token } } = options, downloadOptions = __rest(options, ["findBy"]);
|
||||||
return (0, download_artifact_1.downloadArtifactPublic)(artifactId, repositoryOwner, repositoryName, token, downloadOptions);
|
return (0, download_artifact_1.downloadArtifactPublic)(artifactId, repositoryOwner, repositoryName, token, downloadOptions);
|
||||||
@@ -5057,29 +5037,21 @@ If the error persists, please check whether Actions is operating normally at [ht
|
|||||||
return (0, download_artifact_1.downloadArtifactInternal)(artifactId, options);
|
return (0, download_artifact_1.downloadArtifactInternal)(artifactId, options);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
(0, core_1.warning)(`Artifact download failed with error: ${error}.
|
(0, core_1.warning)(`Download Artifact failed with error: ${error}.
|
||||||
|
|
||||||
Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information.
|
Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information.
|
||||||
|
|
||||||
If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`);
|
If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`);
|
||||||
return {
|
throw error;
|
||||||
success: false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* List Artifacts
|
|
||||||
*/
|
|
||||||
listArtifacts(options) {
|
listArtifacts(options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if ((0, config_1.isGhes)()) {
|
|
||||||
(0, core_1.warning)(`@actions/artifact v2.0.0+ and download-artifact@v4+ are not currently supported on GHES.`);
|
|
||||||
return {
|
|
||||||
artifacts: []
|
|
||||||
};
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
|
if ((0, config_1.isGhes)()) {
|
||||||
|
throw new errors_1.GHESNotSupportedError();
|
||||||
|
}
|
||||||
if (options === null || options === void 0 ? void 0 : options.findBy) {
|
if (options === null || options === void 0 ? void 0 : options.findBy) {
|
||||||
const { findBy: { workflowRunId, repositoryOwner, repositoryName, token } } = options;
|
const { findBy: { workflowRunId, repositoryOwner, repositoryName, token } } = options;
|
||||||
return (0, list_artifacts_1.listArtifactsPublic)(workflowRunId, repositoryOwner, repositoryName, token, options === null || options === void 0 ? void 0 : options.latest);
|
return (0, list_artifacts_1.listArtifactsPublic)(workflowRunId, repositoryOwner, repositoryName, token, options === null || options === void 0 ? void 0 : options.latest);
|
||||||
@@ -5092,24 +5064,16 @@ If the error persists, please check whether Actions and API requests are operati
|
|||||||
Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information.
|
Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information.
|
||||||
|
|
||||||
If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`);
|
If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`);
|
||||||
return {
|
throw error;
|
||||||
artifacts: []
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Get Artifact
|
|
||||||
*/
|
|
||||||
getArtifact(artifactName, options) {
|
getArtifact(artifactName, options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
if ((0, config_1.isGhes)()) {
|
|
||||||
(0, core_1.warning)(`@actions/artifact v2.0.0+ and download-artifact@v4+ are not currently supported on GHES.`);
|
|
||||||
return {
|
|
||||||
success: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
|
if ((0, config_1.isGhes)()) {
|
||||||
|
throw new errors_1.GHESNotSupportedError();
|
||||||
|
}
|
||||||
if (options === null || options === void 0 ? void 0 : options.findBy) {
|
if (options === null || options === void 0 ? void 0 : options.findBy) {
|
||||||
const { findBy: { workflowRunId, repositoryOwner, repositoryName, token } } = options;
|
const { findBy: { workflowRunId, repositoryOwner, repositoryName, token } } = options;
|
||||||
return (0, get_artifact_1.getArtifactPublic)(artifactName, workflowRunId, repositoryOwner, repositoryName, token);
|
return (0, get_artifact_1.getArtifactPublic)(artifactName, workflowRunId, repositoryOwner, repositoryName, token);
|
||||||
@@ -5117,19 +5081,17 @@ If the error persists, please check whether Actions and API requests are operati
|
|||||||
return (0, get_artifact_1.getArtifactInternal)(artifactName);
|
return (0, get_artifact_1.getArtifactInternal)(artifactName);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
(0, core_1.warning)(`Fetching Artifact failed with error: ${error}.
|
(0, core_1.warning)(`Get Artifact failed with error: ${error}.
|
||||||
|
|
||||||
Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information.
|
Errors can be temporary, so please try again and optionally run the action with debug mode enabled for more information.
|
||||||
|
|
||||||
If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`);
|
If the error persists, please check whether Actions and API requests are operating normally at [https://githubstatus.com](https://www.githubstatus.com).`);
|
||||||
return {
|
throw error;
|
||||||
success: false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Client = Client;
|
exports.DefaultArtifactClient = DefaultArtifactClient;
|
||||||
//# sourceMappingURL=client.js.map
|
//# sourceMappingURL=client.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
@@ -5186,6 +5148,7 @@ const config_1 = __nccwpck_require__(95042);
|
|||||||
const artifact_twirp_client_1 = __nccwpck_require__(63550);
|
const artifact_twirp_client_1 = __nccwpck_require__(63550);
|
||||||
const generated_1 = __nccwpck_require__(90265);
|
const generated_1 = __nccwpck_require__(90265);
|
||||||
const util_1 = __nccwpck_require__(80565);
|
const util_1 = __nccwpck_require__(80565);
|
||||||
|
const errors_1 = __nccwpck_require__(69398);
|
||||||
const scrubQueryParameters = (url) => {
|
const scrubQueryParameters = (url) => {
|
||||||
const parsed = new URL(url);
|
const parsed = new URL(url);
|
||||||
parsed.search = '';
|
parsed.search = '';
|
||||||
@@ -5247,7 +5210,7 @@ function downloadArtifactPublic(artifactId, repositoryOwner, repositoryName, tok
|
|||||||
catch (error) {
|
catch (error) {
|
||||||
throw new Error(`Unable to download and extract artifact: ${error.message}`);
|
throw new Error(`Unable to download and extract artifact: ${error.message}`);
|
||||||
}
|
}
|
||||||
return { success: true, downloadPath };
|
return { downloadPath };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.downloadArtifactPublic = downloadArtifactPublic;
|
exports.downloadArtifactPublic = downloadArtifactPublic;
|
||||||
@@ -5263,8 +5226,7 @@ function downloadArtifactInternal(artifactId, options) {
|
|||||||
};
|
};
|
||||||
const { artifacts } = yield artifactClient.ListArtifacts(listReq);
|
const { artifacts } = yield artifactClient.ListArtifacts(listReq);
|
||||||
if (artifacts.length === 0) {
|
if (artifacts.length === 0) {
|
||||||
core.warning(`No artifacts found for ID: ${artifactId}\nAre you trying to download from a different run? Try specifying a github-token with \`actions:read\` scope.`);
|
throw new errors_1.ArtifactNotFoundError(`No artifacts found for ID: ${artifactId}\nAre you trying to download from a different run? Try specifying a github-token with \`actions:read\` scope.`);
|
||||||
return { success: false };
|
|
||||||
}
|
}
|
||||||
if (artifacts.length > 1) {
|
if (artifacts.length > 1) {
|
||||||
core.warning('Multiple artifacts found, defaulting to first.');
|
core.warning('Multiple artifacts found, defaulting to first.');
|
||||||
@@ -5284,7 +5246,7 @@ function downloadArtifactInternal(artifactId, options) {
|
|||||||
catch (error) {
|
catch (error) {
|
||||||
throw new Error(`Unable to download and extract artifact: ${error.message}`);
|
throw new Error(`Unable to download and extract artifact: ${error.message}`);
|
||||||
}
|
}
|
||||||
return { success: true, downloadPath };
|
return { downloadPath };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.downloadArtifactInternal = downloadArtifactInternal;
|
exports.downloadArtifactInternal = downloadArtifactInternal;
|
||||||
@@ -5353,7 +5315,9 @@ const util_1 = __nccwpck_require__(80565);
|
|||||||
const user_agent_1 = __nccwpck_require__(79681);
|
const user_agent_1 = __nccwpck_require__(79681);
|
||||||
const artifact_twirp_client_1 = __nccwpck_require__(63550);
|
const artifact_twirp_client_1 = __nccwpck_require__(63550);
|
||||||
const generated_1 = __nccwpck_require__(90265);
|
const generated_1 = __nccwpck_require__(90265);
|
||||||
|
const errors_1 = __nccwpck_require__(69398);
|
||||||
function getArtifactPublic(artifactName, workflowRunId, repositoryOwner, repositoryName, token) {
|
function getArtifactPublic(artifactName, workflowRunId, repositoryOwner, repositoryName, token) {
|
||||||
|
var _a;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const [retryOpts, requestOpts] = (0, retry_options_1.getRetryOptions)(utils_1.defaults);
|
const [retryOpts, requestOpts] = (0, retry_options_1.getRetryOptions)(utils_1.defaults);
|
||||||
const opts = {
|
const opts = {
|
||||||
@@ -5371,16 +5335,10 @@ function getArtifactPublic(artifactName, workflowRunId, repositoryOwner, reposit
|
|||||||
name: artifactName
|
name: artifactName
|
||||||
});
|
});
|
||||||
if (getArtifactResp.status !== 200) {
|
if (getArtifactResp.status !== 200) {
|
||||||
core.warning(`non-200 response from GitHub API: ${getArtifactResp.status}`);
|
throw new errors_1.InvalidResponseError(`Invalid response from GitHub API: ${getArtifactResp.status} (${(_a = getArtifactResp === null || getArtifactResp === void 0 ? void 0 : getArtifactResp.headers) === null || _a === void 0 ? void 0 : _a['x-github-request-id']})`);
|
||||||
return {
|
|
||||||
success: false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
if (getArtifactResp.data.artifacts.length === 0) {
|
if (getArtifactResp.data.artifacts.length === 0) {
|
||||||
core.warning('no artifacts found');
|
throw new errors_1.ArtifactNotFoundError(`Artifact not found for name: ${artifactName}`);
|
||||||
return {
|
|
||||||
success: false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
let artifact = getArtifactResp.data.artifacts[0];
|
let artifact = getArtifactResp.data.artifacts[0];
|
||||||
if (getArtifactResp.data.artifacts.length > 1) {
|
if (getArtifactResp.data.artifacts.length > 1) {
|
||||||
@@ -5388,7 +5346,6 @@ function getArtifactPublic(artifactName, workflowRunId, repositoryOwner, reposit
|
|||||||
core.debug(`More than one artifact found for a single name, returning newest (id: ${artifact.id})`);
|
core.debug(`More than one artifact found for a single name, returning newest (id: ${artifact.id})`);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
success: true,
|
|
||||||
artifact: {
|
artifact: {
|
||||||
name: artifact.name,
|
name: artifact.name,
|
||||||
id: artifact.id,
|
id: artifact.id,
|
||||||
@@ -5410,18 +5367,14 @@ function getArtifactInternal(artifactName) {
|
|||||||
};
|
};
|
||||||
const res = yield artifactClient.ListArtifacts(req);
|
const res = yield artifactClient.ListArtifacts(req);
|
||||||
if (res.artifacts.length === 0) {
|
if (res.artifacts.length === 0) {
|
||||||
core.warning('no artifacts found');
|
throw new errors_1.ArtifactNotFoundError(`Artifact not found for name: ${artifactName}`);
|
||||||
return {
|
|
||||||
success: false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
let artifact = res.artifacts[0];
|
let artifact = res.artifacts[0];
|
||||||
if (res.artifacts.length > 1) {
|
if (res.artifacts.length > 1) {
|
||||||
artifact = res.artifacts.sort((a, b) => Number(b.databaseId) - Number(a.databaseId))[0];
|
artifact = res.artifacts.sort((a, b) => Number(b.databaseId) - Number(a.databaseId))[0];
|
||||||
core.debug(`more than one artifact found for a single name, returning newest (id: ${artifact.databaseId})`);
|
core.debug(`More than one artifact found for a single name, returning newest (id: ${artifact.databaseId})`);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
success: true,
|
|
||||||
artifact: {
|
artifact: {
|
||||||
name: artifact.name,
|
name: artifact.name,
|
||||||
id: Number(artifact.databaseId),
|
id: Number(artifact.databaseId),
|
||||||
@@ -5693,8 +5646,7 @@ class ArtifactHttpClient {
|
|||||||
'Content-Type': contentType
|
'Content-Type': contentType
|
||||||
};
|
};
|
||||||
try {
|
try {
|
||||||
const response = yield this.retryableRequest(() => __awaiter(this, void 0, void 0, function* () { return this.httpClient.post(url, JSON.stringify(data), headers); }));
|
const { body } = yield this.retryableRequest(() => __awaiter(this, void 0, void 0, function* () { return this.httpClient.post(url, JSON.stringify(data), headers); }));
|
||||||
const body = yield response.readBody();
|
|
||||||
return JSON.parse(body);
|
return JSON.parse(body);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
@@ -5711,13 +5663,19 @@ class ArtifactHttpClient {
|
|||||||
try {
|
try {
|
||||||
const response = yield operation();
|
const response = yield operation();
|
||||||
const statusCode = response.message.statusCode;
|
const statusCode = response.message.statusCode;
|
||||||
(0, core_1.debug)(`[Response] ${response.message.statusCode}`);
|
const body = yield response.readBody();
|
||||||
(0, core_1.debug)(JSON.stringify(response.message.headers, null, 2));
|
(0, core_1.debug)(`[Response] - ${response.message.statusCode}`);
|
||||||
|
(0, core_1.debug)(`Headers: ${JSON.stringify(response.message.headers, null, 2)}`);
|
||||||
|
(0, core_1.debug)(`Body: ${body}`);
|
||||||
if (this.isSuccessStatusCode(statusCode)) {
|
if (this.isSuccessStatusCode(statusCode)) {
|
||||||
return response;
|
return { response, body };
|
||||||
}
|
}
|
||||||
isRetryable = this.isRetryableHttpStatusCode(statusCode);
|
isRetryable = this.isRetryableHttpStatusCode(statusCode);
|
||||||
errorMessage = `Failed request: (${statusCode}) ${response.message.statusMessage}`;
|
errorMessage = `Failed request: (${statusCode}) ${response.message.statusMessage}`;
|
||||||
|
const responseMessage = JSON.parse(body).msg;
|
||||||
|
if (responseMessage) {
|
||||||
|
errorMessage = `${errorMessage}: ${responseMessage}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
isRetryable = true;
|
isRetryable = true;
|
||||||
@@ -5750,8 +5708,7 @@ class ArtifactHttpClient {
|
|||||||
http_client_1.HttpCodes.GatewayTimeout,
|
http_client_1.HttpCodes.GatewayTimeout,
|
||||||
http_client_1.HttpCodes.InternalServerError,
|
http_client_1.HttpCodes.InternalServerError,
|
||||||
http_client_1.HttpCodes.ServiceUnavailable,
|
http_client_1.HttpCodes.ServiceUnavailable,
|
||||||
http_client_1.HttpCodes.TooManyRequests,
|
http_client_1.HttpCodes.TooManyRequests
|
||||||
413 // Payload Too Large
|
|
||||||
];
|
];
|
||||||
return retryableStatusCodes.includes(statusCode);
|
return retryableStatusCodes.includes(statusCode);
|
||||||
}
|
}
|
||||||
@@ -5844,6 +5801,50 @@ exports.getConcurrency = getConcurrency;
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 69398:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
exports.GHESNotSupportedError = exports.ArtifactNotFoundError = exports.InvalidResponseError = exports.FilesNotFoundError = void 0;
|
||||||
|
class FilesNotFoundError extends Error {
|
||||||
|
constructor(files = []) {
|
||||||
|
let message = 'No files were found to upload';
|
||||||
|
if (files.length > 0) {
|
||||||
|
message += `: ${files.join(', ')}`;
|
||||||
|
}
|
||||||
|
super(message);
|
||||||
|
this.files = files;
|
||||||
|
this.name = 'FilesNotFoundError';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.FilesNotFoundError = FilesNotFoundError;
|
||||||
|
class InvalidResponseError extends Error {
|
||||||
|
constructor(message) {
|
||||||
|
super(message);
|
||||||
|
this.name = 'InvalidResponseError';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.InvalidResponseError = InvalidResponseError;
|
||||||
|
class ArtifactNotFoundError extends Error {
|
||||||
|
constructor(message = 'Artifact not found') {
|
||||||
|
super(message);
|
||||||
|
this.name = 'ArtifactNotFoundError';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.ArtifactNotFoundError = ArtifactNotFoundError;
|
||||||
|
class GHESNotSupportedError extends Error {
|
||||||
|
constructor(message = '@actions/artifact v2.0.0+, upload-artifact@v4+ and download-artifact@v4+ are not currently supported on GHES.') {
|
||||||
|
super(message);
|
||||||
|
this.name = 'GHESNotSupportedError';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.GHESNotSupportedError = GHESNotSupportedError;
|
||||||
|
//# sourceMappingURL=errors.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ 2538:
|
/***/ 2538:
|
||||||
/***/ ((__unused_webpack_module, exports) => {
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
@@ -6027,28 +6028,16 @@ function uploadZipToBlobStorage(authenticatedUploadURL, zipUploadStream) {
|
|||||||
const hashStream = crypto.createHash('sha256');
|
const hashStream = crypto.createHash('sha256');
|
||||||
zipUploadStream.pipe(uploadStream); // This stream is used for the upload
|
zipUploadStream.pipe(uploadStream); // This stream is used for the upload
|
||||||
zipUploadStream.pipe(hashStream).setEncoding('hex'); // This stream is used to compute a hash of the zip content that gets used. Integrity check
|
zipUploadStream.pipe(hashStream).setEncoding('hex'); // This stream is used to compute a hash of the zip content that gets used. Integrity check
|
||||||
try {
|
core.info('Beginning upload of artifact content to blob storage');
|
||||||
core.info('Beginning upload of artifact content to blob storage');
|
yield blockBlobClient.uploadStream(uploadStream, bufferSize, maxConcurrency, options);
|
||||||
yield blockBlobClient.uploadStream(uploadStream, bufferSize, maxConcurrency, options);
|
core.info('Finished uploading artifact content to blob storage!');
|
||||||
core.info('Finished uploading artifact content to blob storage!');
|
hashStream.end();
|
||||||
hashStream.end();
|
sha256Hash = hashStream.read();
|
||||||
sha256Hash = hashStream.read();
|
core.info(`SHA256 hash of uploaded artifact zip is ${sha256Hash}`);
|
||||||
core.info(`SHA256 hash of uploaded artifact zip is ${sha256Hash}`);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
core.warning(`Failed to upload artifact zip to blob storage, error: ${error}`);
|
|
||||||
return {
|
|
||||||
isSuccess: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (uploadByteCount === 0) {
|
if (uploadByteCount === 0) {
|
||||||
core.warning(`No data was uploaded to blob storage. Reported upload byte count is 0`);
|
core.warning(`No data was uploaded to blob storage. Reported upload byte count is 0.`);
|
||||||
return {
|
|
||||||
isSuccess: false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
isSuccess: true,
|
|
||||||
uploadSize: uploadByteCount,
|
uploadSize: uploadByteCount,
|
||||||
sha256Hash
|
sha256Hash
|
||||||
};
|
};
|
||||||
@@ -6242,18 +6231,15 @@ const util_1 = __nccwpck_require__(80565);
|
|||||||
const blob_upload_1 = __nccwpck_require__(63311);
|
const blob_upload_1 = __nccwpck_require__(63311);
|
||||||
const zip_1 = __nccwpck_require__(6180);
|
const zip_1 = __nccwpck_require__(6180);
|
||||||
const generated_1 = __nccwpck_require__(90265);
|
const generated_1 = __nccwpck_require__(90265);
|
||||||
|
const errors_1 = __nccwpck_require__(69398);
|
||||||
function uploadArtifact(name, files, rootDirectory, options) {
|
function uploadArtifact(name, files, rootDirectory, options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
(0, path_and_artifact_name_validation_1.validateArtifactName)(name);
|
(0, path_and_artifact_name_validation_1.validateArtifactName)(name);
|
||||||
(0, upload_zip_specification_1.validateRootDirectory)(rootDirectory);
|
(0, upload_zip_specification_1.validateRootDirectory)(rootDirectory);
|
||||||
const zipSpecification = (0, upload_zip_specification_1.getUploadZipSpecification)(files, rootDirectory);
|
const zipSpecification = (0, upload_zip_specification_1.getUploadZipSpecification)(files, rootDirectory);
|
||||||
if (zipSpecification.length === 0) {
|
if (zipSpecification.length === 0) {
|
||||||
core.warning(`No files were found to upload`);
|
throw new errors_1.FilesNotFoundError(zipSpecification.flatMap(s => (s.sourcePath ? [s.sourcePath] : [])));
|
||||||
return {
|
|
||||||
success: false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
const zipUploadStream = yield (0, zip_1.createZipUploadStream)(zipSpecification, options === null || options === void 0 ? void 0 : options.compressionLevel);
|
|
||||||
// get the IDs needed for the artifact creation
|
// get the IDs needed for the artifact creation
|
||||||
const backendIds = (0, util_1.getBackendIdsFromToken)();
|
const backendIds = (0, util_1.getBackendIdsFromToken)();
|
||||||
// create the artifact client
|
// create the artifact client
|
||||||
@@ -6272,18 +6258,11 @@ function uploadArtifact(name, files, rootDirectory, options) {
|
|||||||
}
|
}
|
||||||
const createArtifactResp = yield artifactClient.CreateArtifact(createArtifactReq);
|
const createArtifactResp = yield artifactClient.CreateArtifact(createArtifactReq);
|
||||||
if (!createArtifactResp.ok) {
|
if (!createArtifactResp.ok) {
|
||||||
core.warning(`Failed to create artifact`);
|
throw new errors_1.InvalidResponseError('CreateArtifact: response from backend was not ok');
|
||||||
return {
|
|
||||||
success: false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
const zipUploadStream = yield (0, zip_1.createZipUploadStream)(zipSpecification, options === null || options === void 0 ? void 0 : options.compressionLevel);
|
||||||
// Upload zip to blob storage
|
// Upload zip to blob storage
|
||||||
const uploadResult = yield (0, blob_upload_1.uploadZipToBlobStorage)(createArtifactResp.signedUploadUrl, zipUploadStream);
|
const uploadResult = yield (0, blob_upload_1.uploadZipToBlobStorage)(createArtifactResp.signedUploadUrl, zipUploadStream);
|
||||||
if (uploadResult.isSuccess === false) {
|
|
||||||
return {
|
|
||||||
success: false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
// finalize the artifact
|
// finalize the artifact
|
||||||
const finalizeArtifactReq = {
|
const finalizeArtifactReq = {
|
||||||
workflowRunBackendId: backendIds.workflowRunBackendId,
|
workflowRunBackendId: backendIds.workflowRunBackendId,
|
||||||
@@ -6299,15 +6278,11 @@ function uploadArtifact(name, files, rootDirectory, options) {
|
|||||||
core.info(`Finalizing artifact upload`);
|
core.info(`Finalizing artifact upload`);
|
||||||
const finalizeArtifactResp = yield artifactClient.FinalizeArtifact(finalizeArtifactReq);
|
const finalizeArtifactResp = yield artifactClient.FinalizeArtifact(finalizeArtifactReq);
|
||||||
if (!finalizeArtifactResp.ok) {
|
if (!finalizeArtifactResp.ok) {
|
||||||
core.warning(`Failed to finalize artifact`);
|
throw new errors_1.InvalidResponseError('FinalizeArtifact: response from backend was not ok');
|
||||||
return {
|
|
||||||
success: false
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
const artifactId = BigInt(finalizeArtifactResp.artifactId);
|
const artifactId = BigInt(finalizeArtifactResp.artifactId);
|
||||||
core.info(`Artifact ${name}.zip successfully finalized. Artifact ID ${artifactId}`);
|
core.info(`Artifact ${name}.zip successfully finalized. Artifact ID ${artifactId}`);
|
||||||
return {
|
return {
|
||||||
success: true,
|
|
||||||
size: uploadResult.uploadSize,
|
size: uploadResult.uploadSize,
|
||||||
id: Number(artifactId)
|
id: Number(artifactId)
|
||||||
};
|
};
|
||||||
@@ -122076,9 +122051,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const core = __importStar(__nccwpck_require__(42186));
|
const core = __importStar(__nccwpck_require__(42186));
|
||||||
const artifact_1 = __nccwpck_require__(99860);
|
const artifact_1 = __importDefault(__nccwpck_require__(99860));
|
||||||
const search_1 = __nccwpck_require__(13930);
|
const search_1 = __nccwpck_require__(13930);
|
||||||
const input_helper_1 = __nccwpck_require__(46455);
|
const input_helper_1 = __nccwpck_require__(46455);
|
||||||
const constants_1 = __nccwpck_require__(69042);
|
const constants_1 = __nccwpck_require__(69042);
|
||||||
@@ -122108,7 +122086,6 @@ function run() {
|
|||||||
const s = searchResult.filesToUpload.length === 1 ? '' : 's';
|
const s = searchResult.filesToUpload.length === 1 ? '' : 's';
|
||||||
core.info(`With the provided path, there will be ${searchResult.filesToUpload.length} file${s} uploaded`);
|
core.info(`With the provided path, there will be ${searchResult.filesToUpload.length} file${s} uploaded`);
|
||||||
core.debug(`Root artifact directory is ${searchResult.rootDirectory}`);
|
core.debug(`Root artifact directory is ${searchResult.rootDirectory}`);
|
||||||
const artifactClient = (0, artifact_1.create)();
|
|
||||||
const options = {};
|
const options = {};
|
||||||
if (inputs.retentionDays) {
|
if (inputs.retentionDays) {
|
||||||
options.retentionDays = inputs.retentionDays;
|
options.retentionDays = inputs.retentionDays;
|
||||||
@@ -122116,14 +122093,9 @@ function run() {
|
|||||||
if (typeof inputs.compressionLevel !== 'undefined') {
|
if (typeof inputs.compressionLevel !== 'undefined') {
|
||||||
options.compressionLevel = inputs.compressionLevel;
|
options.compressionLevel = inputs.compressionLevel;
|
||||||
}
|
}
|
||||||
const uploadResponse = yield artifactClient.uploadArtifact(inputs.artifactName, searchResult.filesToUpload, searchResult.rootDirectory, options);
|
const uploadResponse = yield artifact_1.default.uploadArtifact(inputs.artifactName, searchResult.filesToUpload, searchResult.rootDirectory, options);
|
||||||
if (uploadResponse.success === false) {
|
core.info(`Artifact ${inputs.artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`);
|
||||||
core.setFailed(`An error was encountered when uploading ${inputs.artifactName}.`);
|
core.setOutput('artifact-id', uploadResponse.id);
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.info(`Artifact ${inputs.artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`);
|
|
||||||
core.setOutput('artifact-id', uploadResponse.id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
@@ -122388,7 +122360,7 @@ module.exports = JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45,46],"valid"]
|
|||||||
/***/ ((module) => {
|
/***/ ((module) => {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.0.0","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","@types/unzipper":"^0.10.6","archiver":"^5.3.1","crypto":"^1.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzipper":"^0.10.14"},"devDependencies":{"@types/archiver":"^5.3.2","typescript":"^5.2.2"}}');
|
module.exports = JSON.parse('{"name":"@actions/artifact","version":"2.0.0","preview":true,"description":"Actions artifact lib","keywords":["github","actions","artifact"],"homepage":"https://github.com/actions/toolkit/tree/main/packages/artifact","license":"MIT","main":"lib/artifact.js","types":"lib/artifact.d.ts","directories":{"lib":"lib","test":"__tests__"},"files":["lib","!.DS_Store"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/actions/toolkit.git","directory":"packages/artifact"},"scripts":{"audit-moderate":"npm install && npm audit --json --audit-level=moderate > audit.json","test":"cd ../../ && npm run test ./packages/artifact","bootstrap":"cd ../../ && npm run bootstrap","tsc-run":"tsc","tsc":"npm run bootstrap && npm run tsc-run","gen:docs":"typedoc --plugin typedoc-plugin-markdown --out docs/generated src/artifact.ts --githubPages false --readme none"},"bugs":{"url":"https://github.com/actions/toolkit/issues"},"dependencies":{"@actions/core":"^1.10.0","@actions/github":"^5.1.1","@actions/http-client":"^2.1.0","@azure/storage-blob":"^12.15.0","@octokit/core":"^3.5.1","@octokit/plugin-request-log":"^1.0.4","@octokit/plugin-retry":"^3.0.9","@octokit/request-error":"^5.0.0","@protobuf-ts/plugin":"^2.2.3-alpha.1","@types/unzipper":"^0.10.6","archiver":"^5.3.1","crypto":"^1.0.1","jwt-decode":"^3.1.2","twirp-ts":"^2.5.0","unzipper":"^0.10.14"},"devDependencies":{"@types/archiver":"^5.3.2","typedoc":"^0.25.4","typedoc-plugin-markdown":"^3.17.1","typescript":"^5.2.2"}}');
|
||||||
|
|
||||||
/***/ })
|
/***/ })
|
||||||
|
|
||||||
|
|||||||
Generated
+2498
-247
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "upload-artifact",
|
"name": "upload-artifact",
|
||||||
"version": "3.0.0",
|
"version": "4.0.0",
|
||||||
"description": "Upload a build artifact that can be used by subsequent workflow steps",
|
"description": "Upload an Actions Artifact in a workflow run",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
|
|||||||
+7
-15
@@ -1,7 +1,6 @@
|
|||||||
import * as core from '../node_modules/@actions/core/'
|
import * as core from '../node_modules/@actions/core/'
|
||||||
import {
|
import artifact, {
|
||||||
UploadArtifactOptions,
|
UploadArtifactOptions
|
||||||
create
|
|
||||||
} from '../node_modules/@actions/artifact/lib/artifact'
|
} from '../node_modules/@actions/artifact/lib/artifact'
|
||||||
import {findFilesToUpload} from './search'
|
import {findFilesToUpload} from './search'
|
||||||
import {getInputs} from './input-helper'
|
import {getInputs} from './input-helper'
|
||||||
@@ -40,7 +39,6 @@ async function run(): Promise<void> {
|
|||||||
)
|
)
|
||||||
core.debug(`Root artifact directory is ${searchResult.rootDirectory}`)
|
core.debug(`Root artifact directory is ${searchResult.rootDirectory}`)
|
||||||
|
|
||||||
const artifactClient = create()
|
|
||||||
const options: UploadArtifactOptions = {}
|
const options: UploadArtifactOptions = {}
|
||||||
if (inputs.retentionDays) {
|
if (inputs.retentionDays) {
|
||||||
options.retentionDays = inputs.retentionDays
|
options.retentionDays = inputs.retentionDays
|
||||||
@@ -50,23 +48,17 @@ async function run(): Promise<void> {
|
|||||||
options.compressionLevel = inputs.compressionLevel
|
options.compressionLevel = inputs.compressionLevel
|
||||||
}
|
}
|
||||||
|
|
||||||
const uploadResponse = await artifactClient.uploadArtifact(
|
const uploadResponse = await artifact.uploadArtifact(
|
||||||
inputs.artifactName,
|
inputs.artifactName,
|
||||||
searchResult.filesToUpload,
|
searchResult.filesToUpload,
|
||||||
searchResult.rootDirectory,
|
searchResult.rootDirectory,
|
||||||
options
|
options
|
||||||
)
|
)
|
||||||
|
|
||||||
if (uploadResponse.success === false) {
|
core.info(
|
||||||
core.setFailed(
|
`Artifact ${inputs.artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`
|
||||||
`An error was encountered when uploading ${inputs.artifactName}.`
|
)
|
||||||
)
|
core.setOutput('artifact-id', uploadResponse.id)
|
||||||
} else {
|
|
||||||
core.info(
|
|
||||||
`Artifact ${inputs.artifactName} has been successfully uploaded! Final size is ${uploadResponse.size} bytes. Artifact ID is ${uploadResponse.id}`
|
|
||||||
)
|
|
||||||
core.setOutput('artifact-id', uploadResponse.id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed((error as Error).message)
|
core.setFailed((error as Error).message)
|
||||||
|
|||||||
Reference in New Issue
Block a user