Compare commits

..

8 Commits

Author SHA1 Message Date
Josh Gross
c24449f33c
Merge pull request #608 from actions/joshmgross/fix-include-hidden-files-input-node20
Ensure hidden files input is used
2024-09-02 12:45:52 -04:00
Josh Gross
2339de448d
Ensure hidden files input is used 2024-09-02 12:29:26 -04:00
Ryan Troost
672174a5ba
Merge pull request #606 from actions/v3/node16
Carry forward `v3/node16` updates to `v3/node20`
2024-08-29 11:55:17 -04:00
Ryan Troost
9ee08a3b00
Merge pull request #604 from actions/v3/backport-exclude-hidden-files
V3 backport: Exclude hidden files by default
2024-08-29 11:44:05 -04:00
Ryan Troost
ff37344dc2
Update documentation for action 2024-08-22 14:46:08 +00:00
Ryan Troost
d99c5eca07
update readme with section 2024-08-22 14:43:51 +00:00
Ryan Troost
afc7e4a27d
Exclude hidden files by default backport 2024-08-22 14:36:56 +00:00
Rob Herley
97a0fba137
use node20 2024-03-18 15:56:53 +00:00
205 changed files with 11988 additions and 276959 deletions

View File

@ -10,11 +10,9 @@ on:
push: push:
branches: branches:
- main - main
paths-ignore:
- '**.md'
pull_request: pull_request:
paths-ignore: branches:
- '**.md' - main
workflow_dispatch: workflow_dispatch:
jobs: jobs:
@ -22,32 +20,33 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v3
- name: Setup Node 20 - name: Setup Node 16
uses: actions/setup-node@v4 uses: actions/setup-node@v3
with: with:
node-version: 20.x node-version: 16.x
cache: 'npm' cache: 'npm'
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Rebuild the dist/ directory - name: Move the committed index.js file
run: mv dist/index.js /tmp
- name: Rebuild with tsc
run: npm run build
- name: Rebuild the index.js file
run: npm run release run: npm run release
- name: Compare the expected and actual dist/ directories - name: Compare the expected and actual index.js files
run: | run: git diff --ignore-all-space dist/index.js /tmp/index.js
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
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@v4 - uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }} if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with: with:
name: dist name: index.js
path: dist/ path: dist/index.js

View File

@ -17,11 +17,11 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
uses: github/codeql-action/init@v3 uses: github/codeql-action/init@v2
# Override language selection by uncommenting this and choosing your languages # Override language selection by uncommenting this and choosing your languages
# with: # with:
# languages: go, javascript, csharp, python, cpp, java # languages: go, javascript, csharp, python, cpp, java
@ -29,7 +29,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below) # If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild - name: Autobuild
uses: github/codeql-action/autobuild@v3 uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell. # Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl # 📚 https://git.io/JvXDl
@ -43,4 +43,4 @@ jobs:
# make release # make release
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3 uses: github/codeql-action/analyze@v2

View File

@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
name: Check licenses name: Check licenses
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v2
- run: npm ci - run: npm ci
- name: Install licensed - name: Install licensed
run: | run: |

View File

@ -1,20 +0,0 @@
name: 'Publish Immutable Action Version'
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Checking out
uses: actions/checkout@v4
- name: Publish
id: publish
uses: actions/publish-immutable-action@0.0.3

View File

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

View File

@ -1,5 +1,4 @@
name: Test name: Test
on: on:
push: push:
branches: branches:
@ -11,6 +10,7 @@ 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@v4 uses: actions/checkout@v3
- name: Setup Node 20 - name: Setup Node 16
uses: actions/setup-node@v4 uses: actions/setup-node@v3
with: with:
node-version: 20.x node-version: 16.x
cache: 'npm' cache: 'npm'
- name: Install dependencies - name: Install dependencies
@ -46,57 +46,51 @@ jobs:
- name: Test - name: Test
run: npm run test run: npm run test
# Test end-to-end by uploading a few artifacts and then downloading them # Test end-to-end by uploading two artifacts and then downloading them
- name: Create artifact files - name: Create artifact files
run: | run: |
mkdir -p path/to/dir-1 mkdir -p path/to/dir-1
mkdir -p path/to/dir-2 mkdir -p path/to/dir-2
mkdir -p path/to/dir-3 mkdir -p path/to/dir-3
mkdir -p symlink/
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 "Hello from a symlinked file" > symlink/original.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
ln -s $(pwd)/symlink/original.txt symlink/abs.txt
ln -s original.txt symlink/rel.txt
shell: bash
# 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-${{ matrix.runs-on }}' name: 'Artifact-A'
path: path/to/dir-1/file1.txt path: path/to/dir-1/file1.txt
# Upload using a wildcard pattern # Upload using a wildcard pattern, name should default to 'artifact' if not provided
- 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 multi-path artifact # Upload a directory that contains a file that will be uploaded with GZip
- name: 'Upload artifact #3' - name: 'Upload artifact #3'
uses: ./ uses: ./
with: with:
name: 'Multi-Path-Artifact-${{ matrix.runs-on }}' name: 'GZip-Artifact'
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]/*
!path/to/dir-3/*.txt !path/to/dir-3/*.txt
- name: 'Upload symlinked artifact'
uses: ./
with:
name: 'Symlinked-Artifact-${{ matrix.runs-on }}'
path: |
symlink/abs.txt
symlink/rel.txt
# 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@v4 uses: actions/download-artifact@v3
with: with:
name: 'Artifact-A-${{ matrix.runs-on }}' name: 'Artifact-A'
path: some/new/path path: some/new/path
- name: 'Verify Artifact #1' - name: 'Verify Artifact #1'
@ -114,9 +108,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@v4 uses: actions/download-artifact@v3
with: with:
name: 'Artifact-Wildcard-${{ matrix.runs-on }}' name: 'artifact'
path: some/other/path path: some/other/path
- name: 'Verify Artifact #2' - name: 'Verify Artifact #2'
@ -133,11 +127,31 @@ jobs:
} }
shell: pwsh shell: pwsh
# Download Artifact #4 and verify the correctness of the content # Download Artifact #3 and verify the correctness of the content
- name: 'Download artifact #4' - name: 'Download artifact #3'
uses: actions/download-artifact@v4 uses: actions/download-artifact@v3
with: with:
name: 'Multi-Path-Artifact-${{ matrix.runs-on }}' 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'
uses: actions/download-artifact@v3
with:
name: 'Multi-Path-Artifact'
path: multi/artifact path: multi/artifact
- name: 'Verify Artifact #4' - name: 'Verify Artifact #4'
@ -153,140 +167,3 @@ jobs:
Write-Error "File contents of downloaded artifacts are incorrect" Write-Error "File contents of downloaded artifacts are incorrect"
} }
shell: pwsh shell: pwsh
- name: 'Download symlinked artifact'
uses: actions/download-artifact@v4
with:
name: 'Symlinked-Artifact-${{ matrix.runs-on }}'
path: from/symlink
- name: 'Verify symlinked artifact'
run: |
$abs = "from/symlink/abs.txt"
if(!(Test-Path -path $abs))
{
Write-Error "Expected file does not exist"
}
if(!((Get-Content $abs) -ceq "Hello from a symlinked file"))
{
Write-Error "File contents of downloaded artifact are incorrect"
}
$rel = "from/symlink/rel.txt"
if(!(Test-Path -path $rel))
{
Write-Error "Expected file does not exist"
}
if(!((Get-Content $rel) -ceq "Hello from a symlinked file"))
{
Write-Error "File contents of downloaded artifact are incorrect"
}
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'
uses: ./
with:
name: 'Artifact-A-${{ matrix.runs-on }}'
path: path/to/dir-1/file1.txt
overwrite: true
# Download replaced Artifact #1 and verify the correctness of the content
- name: 'Download artifact #1 again'
uses: actions/download-artifact@v4
with:
name: 'Artifact-A-${{ matrix.runs-on }}'
path: overwrite/some/new/path
- name: 'Verify Artifact #1 again'
run: |
$file = "overwrite/some/new/path/file1.txt"
if(!(Test-Path -path $file))
{
Write-Error "Expected file does not exist"
}
if(!((Get-Content $file) -ceq "This file has changed"))
{
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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More