Compare commits

..

47 Commits

Author SHA1 Message Date
Rob Herley 834a144ee9
Merge pull request #594 from actions/robherley/4.3.6
Revert to @actions/artifact 2.1.8
2024-08-06 10:41:08 -04:00
Rob Herley 134dcf33c0
v4.3.6 2024-08-06 10:24:34 -04:00
Rob Herley 73a0b9c954
revert back to @actions/artifact 2.1.8 2024-08-06 10:23:43 -04:00
Rob Herley 89ef406dd8
Merge pull request #588 from actions/robherley/4.3.5
Bump @actions/artifact to v2.1.9
2024-08-02 09:59:06 -04:00
Rob Herley 23d796df36
license updates 2024-08-01 15:50:32 -04:00
Rob Herley e445c64bc2
bump @actions/artifact to v2.1.9 2024-08-01 15:46:49 -04:00
Rob Herley 0b2256b8c0
Merge pull request #584 from actions/robherley/bump-pkgs
Update @actions/artifact version, bump dependencies
2024-07-05 11:11:13 -04:00
Rob Herley 488dcefb9b
licensed cache 2024-07-05 14:39:15 +00:00
Rob Herley 04c51f5766
ncc 2024-07-05 13:55:51 +00:00
Rob Herley 32a9e276a8
bump @actions/artifact and npm audit 2024-07-05 13:51:02 +00:00
Jonathan Tamsut 552bf3722c new version 2024-04-23 11:22:42 -07:00
eggyhead 79616d2ded
Merge pull request #565 from actions/eggyhead/use-artifact-v2.1.6
updating toolkit artifact dependency to 2.1.6
2024-04-22 09:19:03 -07:00
Your Name 65462800fd updating package version 2024-04-22 08:10:47 -07:00
eggyhead c004fb4bf6
Merge branch 'main' into eggyhead/use-artifact-v2.1.6 2024-04-22 08:08:40 -07:00
Your Name 90aba496fc updating toolkit artifact dependency to 2.1.6 2024-04-22 08:06:58 -07:00
eggyhead b06cde36fc
Merge pull request #563 from actions/eggyhead/release-4.3.2
updating to release 4.3.2
2024-04-18 08:13:48 -07:00
eggyhead 1746f4ab65 Revert "updating to release 4.3.2"
This reverts commit 31685d04a0.

updating to release 4.3.2
2024-04-18 15:05:07 +00:00
eggyhead 31685d04a0 updating to release 4.3.2 2024-04-18 14:56:48 +00:00
eggyhead 18bf333cd2
Merge pull request #562 from actions/eggyhead/update-artifact-v215
updating `@actions/artifact` dependency to v2.1.5 and `@actions/core` to v1.0.1
2024-04-17 15:05:29 -07:00
eggyhead dac413befa update package lock version 2024-04-17 21:24:58 +00:00
eggyhead bb3b4a3cdb updating package version 2024-04-17 20:38:47 +00:00
eggyhead 3e3da837d2 updating artifact and core dependencies 2024-04-17 17:00:25 +00:00
Rob Herley e35774f165
Merge pull request #561 from actions/robherley/deprecation-notice
Update readme with v3/v2/v1 deprecation notice
2024-04-16 17:12:57 -04:00
Rob Herley e63ea677fb
Update readme with v3/v2/v1 deprecation notice
- https://github.blog/changelog/2024-02-13-deprecation-notice-v1-and-v2-of-the-artifact-actions/
- https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/
2024-04-16 16:48:37 -04:00
Rob Herley ef09cdac3e
Merge pull request #523 from andrewakim/andrewakim/migration-readme-fix
Minor fix to the migration readme
2024-02-15 14:06:33 -05:00
Andrew Kim 00e36f94d8
Minor fix to the migration readme 2024-02-15 11:01:40 -08:00
Konrad Pabjan 4c0ff1c489
Update release-new-action-version.yml (#516) 2024-02-05 17:19:59 -05:00
eggyhead 5d5d22a312
Merge pull request #515 from actions/eggyhead/update-artifact-v2.1.1
updating artifact dependency to version 2.1.1
2024-02-05 13:19:54 -08:00
eggyhead f1e993d966 update artifact license 2024-02-05 17:52:45 +00:00
eggyhead 4881bfd3f2 updating dist: 2024-02-05 17:39:17 +00:00
eggyhead a30777e265 @eggyhead
updating artifact dependency to version 2.1.1
2024-02-05 17:31:38 +00:00
Rob Herley 3a8048248f
Merge pull request #511 from actions/robherley/migration-docs-typo
Fix typo with v3 artifact downloads in migration guide
2024-01-31 12:36:26 -05:00
Rob Herley 9d63e3f2f8
Merge branch 'main' into robherley/migration-docs-typo 2024-01-31 12:34:24 -05:00
Rob Herley dfa1ab292d
fix typo with v3 artifact downloads in migration guide 2024-01-31 12:27:48 -05:00
Rob Herley d00351bf69
Merge pull request #509 from markmssd/patch-1
Update limitation of `10` artifacts upload to `500`
2024-01-29 09:38:17 -05:00
Mark Massoud 707f5a7b71
Update limitation of `10` artifacts upload to `500`
According to https://github.com/actions/upload-artifact/issues/470#issuecomment-1885881535, the limitation has been raised from `10` to `500`. This PR simply updates the docs to reflect the change.
2024-01-27 16:21:08 -05:00
Rob Herley 26f96dfa69
Merge pull request #505 from actions/robherley/merge-artifacts
Add sub-action to merge artifacts
2024-01-23 12:39:33 -05:00
Rob Herley 530ed2c9b8
use correct artifact name in test 2024-01-23 11:26:59 -05:00
Rob Herley 53ef6987b3
add additional integration test for merge all behavior 2024-01-23 11:15:52 -05:00
Rob Herley 90b0f8eed8
add workflow to test merging 2024-01-22 22:50:11 -05:00
Rob Herley 199a58f54f
more docs 2024-01-22 22:24:56 -05:00
Rob Herley 3f353f9d9e
ncc 2024-01-22 21:46:33 -05:00
Rob Herley 997fffa355
add merge artifact sub-action 2024-01-22 21:46:12 -05:00
Rob Herley 52899c8c02
Merge pull request #504 from actions/robherley/reorganize
Reorganize upload code in prep for merge logic & add more tests
2024-01-22 16:56:11 -05:00
Rob Herley da58a3f7b2
ncc 2024-01-22 15:58:20 -05:00
Rob Herley 1f64adb853
fix import 2024-01-22 15:52:35 -05:00
Rob Herley 8d531b15a6
reorganize upload code in prep for merge logic, add more tests 2024-01-22 15:49:34 -05:00
18 changed files with 39546 additions and 32155 deletions

View File

@ -22,7 +22,7 @@ jobs:
steps:
- name: Update the ${{ env.TAG_NAME }} tag
id: update-major-tag
uses: actions/publish-action@v0.2.1
uses: actions/publish-action@v0.3.0
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

View File

@ -141,12 +141,16 @@ jobs:
}
shell: pwsh
- name: 'Alter file 1 content'
run: |
echo "This file has changed" > path/to/dir-1/file1.txt
# Replace the contents of Artifact #1
- name: 'Overwrite artifact #1 again'
- name: 'Overwrite artifact #1'
uses: ./
with:
name: 'Artifact-A-${{ matrix.runs-on }}'
path: path/to/dir-2/file2.txt
path: path/to/dir-1/file1.txt
overwrite: true
# Download replaced Artifact #1 and verify the correctness of the content
@ -158,13 +162,90 @@ jobs:
- name: 'Verify Artifact #1 again'
run: |
$file = "overwrite/some/new/path/file2.txt"
$file = "overwrite/some/new/path/file1.txt"
if(!(Test-Path -path $file))
{
Write-Error "Expected file does not exist"
}
if(!((Get-Content $file) -ceq "Hello world from file #2"))
if(!((Get-Content $file) -ceq "This file has changed"))
{
Write-Error "File contents of downloaded artifacts are incorrect"
Write-Error "File contents of downloaded artifact are incorrect"
}
shell: pwsh
merge:
name: Merge
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
# Merge all artifacts from previous jobs
- name: Merge all artifacts in run
uses: ./merge/
with:
# our matrix produces artifacts with the same file, this prevents "stomping" on each other, also makes it
# easier to identify each of the merged artifacts
separate-directories: true
- name: 'Download merged artifacts'
uses: actions/download-artifact@v4
with:
name: merged-artifacts
path: all-merged-artifacts
- name: 'Check merged artifact has directories for each artifact'
run: |
$artifacts = @(
"Artifact-A-ubuntu-latest",
"Artifact-A-macos-latest",
"Artifact-A-windows-latest",
"Artifact-Wildcard-ubuntu-latest",
"Artifact-Wildcard-macos-latest",
"Artifact-Wildcard-windows-latest",
"Multi-Path-Artifact-ubuntu-latest",
"Multi-Path-Artifact-macos-latest",
"Multi-Path-Artifact-windows-latest"
)
foreach ($artifact in $artifacts) {
$path = "all-merged-artifacts/$artifact"
if (!(Test-Path $path)) {
Write-Error "$path does not exist."
}
}
shell: pwsh
# Merge Artifact-A-* from previous jobs
- name: Merge all Artifact-A
uses: ./merge/
with:
name: Merged-Artifact-As
pattern: 'Artifact-A-*'
separate-directories: true
# Download merged artifacts and verify the correctness of the content
- name: 'Download merged artifacts'
uses: actions/download-artifact@v4
with:
name: Merged-Artifact-As
path: merged-artifact-a
- name: 'Verify merged artifacts'
run: |
$files = @(
"merged-artifact-a/Artifact-A-ubuntu-latest/file1.txt",
"merged-artifact-a/Artifact-A-macos-latest/file1.txt",
"merged-artifact-a/Artifact-A-windows-latest/file1.txt"
)
foreach ($file in $files) {
if (!(Test-Path $file)) {
Write-Error "$file does not exist."
}
if (!((Get-Content $file) -ceq "This file has changed")) {
Write-Error "$file has incorrect content."
}
}
shell: pwsh

View File

@ -1,6 +1,6 @@
---
name: "@actions/artifact"
version: 2.1.0
version: 2.1.8
type: npm
summary:
homepage:

View File

@ -1,6 +1,6 @@
---
name: "@actions/core"
version: 1.10.0
version: 1.10.1
type: npm
summary:
homepage:

View File

@ -1,5 +1,11 @@
# `@actions/upload-artifact`
> [!WARNING]
> actions/upload-artifact@v3 is scheduled for deprecation on **November 30, 2024**. [Learn more.](https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/)
> Similarly, v1/v2 are scheduled for deprecation on **June 30, 2024**.
> Please update your workflow to use v4 of the artifact actions.
> This deprecation will not impact any existing versions of GitHub Enterprise Server being used by customers.
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.
See also [download-artifact](https://github.com/actions/download-artifact).
@ -41,6 +47,8 @@ The release of upload-artifact@v4 and download-artifact@v4 are major changes to
For more information, see the [`@actions/artifact`](https://github.com/actions/toolkit/tree/main/packages/artifact) documentation.
There is also a new sub-action, `actions/upload-artifact/merge`. For more info, check out that action's [README](./merge/README.md).
### Improvements
1. Uploads are significantly faster, upwards of 90% improvement in worst case scenarios.
@ -406,7 +414,7 @@ jobs:
### Number of Artifacts
Within an individual job, there is a limit of 10 artifacts that can be created for that job.
Within an individual job, there is a limit of 500 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.

View File

@ -1,6 +1,6 @@
import * as core from '@actions/core'
import artifact from '@actions/artifact'
import {run} from '../src/merge/merge-artifact'
import {run} from '../src/merge/merge-artifacts'
import {Inputs} from '../src/merge/constants'
import * as search from '../src/shared/search'
@ -55,7 +55,7 @@ jest.mock('fs/promises', () => ({
/* eslint-disable no-unused-vars */
const mockInputs = (overrides?: Partial<{[K in Inputs]?: any}>) => {
const inputs = {
[Inputs.Into]: 'my-merged-artifact',
[Inputs.Name]: 'my-merged-artifact',
[Inputs.Pattern]: '*',
[Inputs.SeparateDirectories]: false,
[Inputs.RetentionDays]: 0,

34174
dist/merge/index.js vendored

File diff suppressed because it is too large Load Diff

36014
dist/upload/index.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
- [Migration](#migration)
- [Multiple uploads to the same named Artifact](#multiple-uploads-to-the-same-named-artifact)
- [Overwriting an Artifact](#overwriting-an-artifact)
- [Merging multiple artifacts](#merging-multiple-artifacts)
Several behavioral differences exist between Artifact actions `v3` and below vs `v4`. This document outlines common scenarios in `v3`, and how they would be handled in `v4`.
@ -32,6 +33,7 @@ jobs:
- name: Download All Artifacts
uses: actions/download-artifact@v3
with:
name: my-artifact
path: my-artifact
- run: ls -R my-artifact
```
@ -72,6 +74,7 @@ jobs:
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@v4
with:
- name: my-artifact
path: my-artifact
+ pattern: my-artifact-*
+ merge-multiple: true
@ -142,3 +145,65 @@ jobs:
```
Note that this will create an _entirely_ new Artifact, with a different ID from the previous.
## Merging multiple artifacts
In `v3`, multiple uploads from multiple jobs could be done to the same Artifact. This would result in a single archive, which could be useful for sending to upstream systems outside of Actions via API or UI downloads.
```yaml
jobs:
upload:
strategy:
matrix:
runs-on: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.runs-on }}
steps:
- name: Create a File
run: echo "hello from ${{ matrix.runs-on }}" > file-${{ matrix.runs-on }}.txt
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: all-my-files # NOTE: same artifact name
path: file-${{ matrix.runs-on }}.txt
```
The single `all-my-files` artifact would contain the following:
```
.
∟ file-ubuntu-latest.txt
∟ file-macos-latest.txt
∟ file-windows-latest.txt
```
To achieve the same in `v4` you can change it like so:
```diff
jobs:
upload:
strategy:
matrix:
runs-on: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.runs-on }}
steps:
- name: Create a File
run: echo "hello from ${{ matrix.runs-on }}" > file-${{ matrix.runs-on }}.txt
- name: Upload Artifact
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
- name: all-my-files
+ name: my-artifact-${{ matrix.runs-on }}
path: file-${{ matrix.runs-on }}.txt
+ merge:
+ runs-on: ubuntu-latest
+ needs: upload
+ steps:
+ - name: Merge Artifacts
+ uses: actions/upload-artifact/merge@v4
+ with:
+ name: all-my-files
+ pattern: my-artifact-*
```
Note that this will download all artifacts to a temporary directory and reupload them as a single artifact. For more information on inputs and other use cases for `actions/upload-artifact/merge@v4`, see [the action documentation](../merge/README.md).

View File

@ -7,6 +7,10 @@ Merge multiple [Actions Artifacts](https://docs.github.com/en/actions/using-work
- [Inputs](#inputs)
- [Outputs](#outputs)
- [Examples](#examples)
- [Combining all artifacts in a workflow run](#combining-all-artifacts-in-a-workflow-run)
- [Prefix directories in merged artifact](#prefix-directories-in-merged-artifact)
- [Deleting artifacts after merge](#deleting-artifacts-after-merge)
- [Retention and Compression Level](#retention-and-compression-level)
## Usage
@ -15,14 +19,18 @@ Merge multiple [Actions Artifacts](https://docs.github.com/en/actions/using-work
Note: this actions can only merge artifacts created with actions/upload-artifact@v4+
This sub-action is a helper to merge multiple artifacts after they are created. To do so, it will download multiple artifacts to a temporary directory and reupload them as a single artifact.
For most cases, this may not be the most efficient solution. See [the migration docs](../docs/MIGRATION.md#multiple-uploads-to-the-same-named-artifact) on how to download multiple artifacts to the same directory on a runner. This action should only be necessary for cases where multiple artifacts will need to be downloaded outside the runner environment, like downloads via the UI or REST API.
### Inputs
```yaml
- uses: actions/upload-artifact/merge@v4
with:
# The name of the artifact that the artifacts will be merged into
# Optional. Default is 'merged-artifact'
into:
# Optional. Default is 'merged-artifacts'
name:
# A glob pattern matching the artifacts that should be merged.
# Optional. Default is '*'
@ -60,4 +68,133 @@ Note: this actions can only merge artifacts created with actions/upload-artifact
## Examples
TODO(robherley): add examples
For each of these examples, assume we have a prior job matrix that generates three artifacts: `my-artifact-a`, `my-artifact-b` and `my-artifact-c`.
e.g.
```yaml
jobs:
upload:
runs-on: ubuntu-latest
strategy:
matrix:
foo: [a, b, c]
steps:
- name: Run a one-line script
run: echo "hello from job ${{ matrix.foo }}" > file-${{ matrix.foo }}.txt
- name: Upload
uses: actions/upload-artifact@v4
with:
name: my-artifact-${{ matrix.foo }}
path: file-${{ matrix.foo }}.txt
```
Each of the following examples will use the `needs: upload` as a prerequesite before any merging operations.
### Combining all artifacts in a workflow run
By default (with no inputs), calling this action will take all the artifacts in the workflow run and combined them into a single artifact called `merged-artifacts`:
```yaml
jobs:
# ... <upload job> ...
merge:
runs-on: ubuntu-latest
needs: upload
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
```
This will result in an artifact called `merged-artifacts` with the following content:
```
.
∟ file-a.txt
∟ file-b.txt
∟ file-c.txt
```
To change the name of the artifact and filter on what artifacts are added, you can use the `name` and `pattern` inputs:
```yaml
jobs:
# ... <upload job> ...
merge:
runs-on: ubuntu-latest
needs: upload
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: my-amazing-merged-artifact
pattern: my-artifact-*
```
### Prefix directories in merged artifact
To prevent overwriting files in artifacts that may have the same name, you can use the `separate-directories` to prefix the extracted files with directories (named after the original artifact):
```yaml
jobs:
# ... <upload job> ...
merge:
runs-on: ubuntu-latest
needs: upload
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
separate-directories: true
```
This will result in the following artifact structure:
```
.
∟ my-artifact-a
∟ file-a.txt
∟ my-artifact-b
∟ file-b.txt
∟ my-artifact-c
∟ file-c.txt
```
### Deleting artifacts after merge
After merge, the old artifacts may no longer be required. To automatically delete them after they are merged into a new artifact, you can use `delete-merged` like so:
```yaml
jobs:
# ... <upload job> ...
merge:
runs-on: ubuntu-latest
needs: upload
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
delete-merged: true
```
After this runs, the matching artifact (`my-artifact-a`, `my-artifact-b` and `my-artifact-c`) will be merged.
### Retention and Compression Level
Similar to actions/upload-artifact, both [`retention-days`](../README.md#retention-period) and [`compression-level`](../README.md#altering-compressions-level-speed-v-size) are supported:
```yaml
jobs:
# ... <upload job> ...
merge:
runs-on: ubuntu-latest
needs: upload
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
retention-days: 1
compression-level: 9
```

View File

@ -2,10 +2,10 @@ name: 'Merge Build Artifacts'
description: 'Merge one or more build Artifacts'
author: 'GitHub'
inputs:
into:
name:
description: 'The name of the artifact that the artifacts will be merged into.'
required: true
default: 'merged-artifact'
default: 'merged-artifacts'
pattern:
description: 'A glob pattern matching the artifact names that should be merged.'
default: '*'

1172
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "upload-artifact",
"version": "4.2.0",
"version": "4.3.6",
"description": "Upload an Actions Artifact in a workflow run",
"main": "dist/upload/index.js",
"scripts": {
@ -29,8 +29,8 @@
},
"homepage": "https://github.com/actions/upload-artifact#readme",
"dependencies": {
"@actions/artifact": "^2.1.0",
"@actions/core": "^1.10.0",
"@actions/artifact": "2.1.8",
"@actions/core": "^1.10.1",
"@actions/github": "^6.0.0",
"@actions/glob": "^0.3.0",
"@actions/io": "^1.1.2",

View File

@ -1,6 +1,6 @@
/* eslint-disable no-unused-vars */
export enum Inputs {
Into = 'into',
Name = 'name',
Pattern = 'pattern',
SeparateDirectories = 'separate-directories',
RetentionDays = 'retention-days',

View File

@ -1,5 +1,5 @@
import * as core from '@actions/core'
import {run} from './merge-artifact'
import {run} from './merge-artifacts'
run().catch(error => {
core.setFailed((error as Error).message)

View File

@ -6,13 +6,13 @@ import {MergeInputs} from './merge-inputs'
* Helper to get all the inputs for the action
*/
export function getInputs(): MergeInputs {
const into = core.getInput(Inputs.Into, {required: true})
const name = core.getInput(Inputs.Name, {required: true})
const pattern = core.getInput(Inputs.Pattern, {required: true})
const separateDirectories = core.getBooleanInput(Inputs.SeparateDirectories)
const deleteMerged = core.getBooleanInput(Inputs.DeleteMerged)
const inputs = {
into,
name,
pattern,
separateDirectories,
deleteMerged,

View File

@ -65,7 +65,7 @@ export async function run(): Promise<void> {
const searchResult = await findFilesToUpload(tmpDir)
await uploadArtifact(
inputs.into,
inputs.name,
searchResult.filesToUpload,
searchResult.rootDirectory,
options

View File

@ -2,7 +2,7 @@ export interface MergeInputs {
/**
* The name of the artifact that the artifacts will be merged into
*/
into: string
name: string
/**
* A glob pattern matching the artifacts that should be merged.