Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/actions/artifact-download/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
The UnLicense

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <https://unlicense.org>
94 changes: 94 additions & 0 deletions .github/actions/artifact-download/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: artifact-download
description: download-artifact

inputs:
ls_cli_options:
description: Options to pass to the ls command
required: false
default: -hla

# If unspecified, all artifacts for the run are downloaded.
name:
description: Name of the artifact to download.
required: false
default: "dist"

# Ignored if name is specified.
pattern:
description: A glob pattern to the artifacts that should be downloaded.
required: false
default: ""

# Either inputs `artifact-ids` or `name` can be used, but not both.
artifact-ids:
description: IDs of the artifacts to download, comma-separated.
required: false
default: ""

# Optional. Default is $GITHUB_WORKSPACE
path:
description: Destination path. Supports basic tilde expansion.
required: false
default: "dist"

# If true, the downloaded artifacts will be in the same directory specified by path.
# If false, the downloaded artifacts will be extracted into individual named directories within the specified path.
# Note: When downloading a single artifact (by name or ID), it will always be extracted directly to the specified path.
merge-multiple:
description: When multiple artifacts are matched, this changes the behavior of the destination directories.
required: false
default: "false"

# This is required when downloading artifacts from a different repository or from a different workflow run.
# Optional. If unspecified, the action will download artifacts from the current repo and the current workflow run.
github-token:
description: The GitHub token used to authenticate with the GitHub API.
required: false
default: ""

# If github-token is specified, this is the repository that artifacts will be downloaded from.
repository:
description: The repository owner and the repository name joined together by "/".
required: false
default: ${{ github.repository }}

# If github-token is specified, this is the run that artifacts will be downloaded from.
run-id:
description: The id of the workflow run where the desired download artifact was uploaded from.
required: false
default: ${{ github.run_id }}

# If true, the downloaded artifact will not be automatically extracted/decompressed.
# This is useful when you want to handle the artifact as-is without extraction.
skip-decompress:
description: Whether to skip decompressing a zip file (if detected).
required: false
default: "false"

# Can be one of: `ignore`, `info`, `warn`, `error`
digest-mismatch:
description: What to do if the action detects a mismatch between the downloaded hash and the expected hash from the server.
required: false
default: "error"

runs:
using: composite
steps:
# SRC: https://github.com/actions/download-artifact
- name: download-artifact
uses: actions/download-artifact@v8
with:
name: ${{ inputs.name }}
path: ${{ inputs.path }}
run-id: ${{ inputs.run-id }}
pattern: ${{ inputs.pattern }}
repository: ${{ inputs.repository }}
artifact-ids: ${{ inputs.artifact-ids }}
github-token: ${{ inputs.github-token }}
merge-multiple: ${{ inputs.merge-multiple }}
skip-decompress: ${{ inputs.skip-decompress }}
digest-mismatch: ${{ inputs.digest-mismatch }}

- name: ls
shell: bash
run: ls ${{ inputs.ls_cli_options }} ${{ inputs.path }}
4 changes: 2 additions & 2 deletions .github/actions/artifact-upload/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: checkout
description: checkout and do some other things
name: artifact-upload
description: upload-artifact

inputs:
ls_cli_options:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test actions/artifact-upload
name: Test actions/artifact-*
on:
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
pull_request:
Expand All @@ -21,6 +21,11 @@ jobs:
- uses: percebus/github-actions-common/.github/actions/checkout@main
- uses: ./.github/actions/artifact-upload

- name: rm ./dist
run: rm -rf ./dist

- uses: ./.github/actions/artifact-download

path__matrix:
needs: default
runs-on: ubuntu-latest
Expand All @@ -38,3 +43,11 @@ jobs:
with:
name: ${{ matrix.path }}
path: assets/${{ matrix.path }}/

- name: rm ./assets/${{ matrix.path }}
run: rm -rf ./assets/${{ matrix.path }}

- uses: ./.github/actions/artifact-download
with:
name: ${{ matrix.path }}
path: downloaded/${{ matrix.path }}/
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ GitHub re-usable Workflows and Actions

### Actions

| action | tests |
| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [checkout](./.github/actions/checkout) | [![Test actions/checkout](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__checkout.yml/badge.svg)](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__checkout.yml) |
| [ssh-agent](./.github/actions/ssh-agent) | [![Test actions/ssh-agent](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__ssh-agent.yml/badge.svg)](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__ssh-agent.yml) |
| [artifact-upload](./.github/actions/artifact-upload) | [![Test actions/artifact-upload](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__artifact-upload.yml/badge.svg)](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__artifact-upload.yml) |
| action | tests |
| -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [checkout](./.github/actions/checkout) | [![Test actions/checkout](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__checkout.yml/badge.svg)](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__checkout.yml) |
| [ssh-agent](./.github/actions/ssh-agent) | [![Test actions/ssh-agent](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__ssh-agent.yml/badge.svg)](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__ssh-agent.yml) |
| [artifact-upload](./.github/actions/artifact-upload) | [![Test actions/artifact-*](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__artifact.yml/badge.svg)](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__artifact.yml) |
| [artifact-download](./.github/actions/artifact-download) | [![Test actions/artifact-*](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__artifact.yml/badge.svg)](https://github.com/percebus/github-actions-common/actions/workflows/test_actions__artifact.yml) |

### Workflows

Expand Down
Loading