feat: add download-artifact and upload-artifact actions with documentation #35

Merged
Michael.Seele merged 1 commit from feature/download-upload-artifact into main 2026-06-01 11:42:24 +00:00
6 changed files with 150 additions and 0 deletions

View file

@ -18,6 +18,7 @@ on:
- aws-configure
- cache
- checkout
- download-artifact
- helm-deploy
- inject-content
- maven-build
@ -25,6 +26,7 @@ on:
- publish-static-contents
- terraform-apply
- terraform-validate
- upload-artifact
major-version:
description: 'Major version number (e.g. 1)'
required: true

View file

@ -11,6 +11,7 @@ Shared actions for Forgejo CI/CD pipelines.
| [aws-configure](aws-configure) | Authenticate with AWS via OIDC |
| [cache](cache) | Cache files between workflow runs |
| [checkout](checkout) | Action for checking out a repository |
| [download-artifact](download-artifact) | Download Forgejo Actions artifacts by name or pattern |
| [helm-deploy](helm-deploy) | Deploy a service to Kubernetes via Helm over SSH |
| [inject-content](inject-content) | Inject content into a file by appending or overwriting |
| [maven-build](maven-build) | Action for building and validating Maven projects |
@ -18,6 +19,7 @@ Shared actions for Forgejo CI/CD pipelines.
| [publish-static-contents](publish-static-contents) | Syncs frontend assets to S3 and invalidates a CloudFront distribution |
| [terraform-apply](terraform-apply) | Apply Terraform configuration files using the official Terraform CLI |
| [terraform-validate](terraform-validate) | Validate Terraform configuration files using the official Terraform CLI |
| [upload-artifact](upload-artifact) | Upload files as a Forgejo Actions artifact |
## Security

View file

@ -0,0 +1,46 @@
# download-artifact
Download Forgejo Actions artifacts by name or pattern. Thin wrapper around `forgejo/download-artifact` pinned to a specific commit SHA to prevent supply chain attacks.
## Inputs
| Input | Required | Default | Description |
|-------|----------|---------|-------------|
| `name` | No | `""` | Exact artifact name or glob pattern (e.g. `blob-report-*`). If omitted, all artifacts for the run are downloaded. |
| `path` | No | `.` | Local destination directory |
| `merge-multiple` | No | `false` | When true, merge all matched artifacts into a single directory |
## Usage
Download a single artifact by name:
```yaml
- uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/download-artifact@download-artifact-v1
with:
name: my-artifact
path: dist/
```
Download all artifacts matching a pattern and merge into one directory:
```yaml
- uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/download-artifact@download-artifact-v1
with:
name: blob-report-*
path: all-blob-reports/
merge-multiple: "true"
```
Download all artifacts for the run:
```yaml
- uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/download-artifact@download-artifact-v1
with:
path: artifacts/
```
## Notes
- Wraps `forgejo/download-artifact` v4 (node20), compatible with Ubuntu 22 runners.
- The underlying action is pinned to a commit SHA rather than a mutable tag to prevent supply chain attacks.
- When `merge-multiple` is false (default), each matched artifact is extracted into its own subdirectory under `path`.

View file

@ -0,0 +1,30 @@
name: Schmalz Download Artifact
description: >
Download Forgejo Actions artifacts by name or pattern.
Thin wrapper around forgejo/download-artifact, pinned to a specific SHA.
inputs:
name:
description: Exact artifact name or glob pattern (e.g. 'blob-report-*'). If omitted, all artifacts for the run are downloaded.
required: false
default: ""
path:
description: Local destination directory
required: false
default: "."
merge-multiple:
description: When true, merge all matched artifacts into a single directory
required: false
default: "false"
runs:
using: composite
steps:
# Pinned to commit SHA instead of a tag to prevent supply chain attacks.
# forgejo/download-artifact v4 — https://code.forgejo.org/forgejo/download-artifact/commits/tag/v4
- name: Download artifact
uses: https://code.forgejo.org/forgejo/download-artifact@d8d0a99033603453ad2255e58720b460a0555e1e
with:
name: ${{ inputs.name }}
path: ${{ inputs.path }}
merge-multiple: ${{ inputs.merge-multiple }}

37
upload-artifact/README.md Normal file
View file

@ -0,0 +1,37 @@
# upload-artifact
Upload files as a Forgejo Actions artifact. Thin wrapper around `forgejo/upload-artifact` pinned to a specific commit SHA to prevent supply chain attacks.
## Inputs
| Input | Required | Default | Description |
|-------|----------|---------|-------------|
| `name` | Yes | — | Artifact name |
| `path` | Yes | — | File or directory path to upload |
| `retention-days` | No | `30` | Number of days to retain the artifact |
| `if-no-files-found` | No | `warn` | Behaviour when no files are found — `warn`, `error`, or `ignore` |
## Usage
```yaml
- uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/upload-artifact@upload-artifact-v1
with:
name: my-artifact
path: dist/
```
Upload and ignore if no files exist:
```yaml
- uses: https://schmalz-git.git.onstackit.cloud/schmalz/shared-actions/upload-artifact@upload-artifact-v1
with:
name: blob-report-${{ matrix.shard-index }}
path: frontend/blob-report/
retention-days: 3
if-no-files-found: ignore
```
## Notes
- Wraps `forgejo/upload-artifact` v4 (node20), compatible with Ubuntu 22 runners.
- The underlying action is pinned to a commit SHA rather than a mutable tag to prevent supply chain attacks.

View file

@ -0,0 +1,33 @@
name: Schmalz Upload Artifact
description: >
Upload files as a Forgejo Actions artifact.
Thin wrapper around forgejo/upload-artifact, pinned to a specific SHA.
inputs:
name:
description: Artifact name
required: true
path:
description: File or directory path to upload
required: true
retention-days:
description: Number of days to retain the artifact
required: false
default: "30"
if-no-files-found:
description: Behaviour when no files are found — 'warn', 'error', or 'ignore'
required: false
default: warn
runs:
using: composite
steps:
# Pinned to commit SHA instead of a tag to prevent supply chain attacks.
# forgejo/upload-artifact v4 — https://code.forgejo.org/forgejo/upload-artifact/commits/tag/v4
- name: Upload artifact
uses: https://code.forgejo.org/forgejo/upload-artifact@16871d9e8cfcf27ff31822cac382bbb5450f1e1e
with:
name: ${{ inputs.name }}
path: ${{ inputs.path }}
retention-days: ${{ inputs.retention-days }}
if-no-files-found: ${{ inputs.if-no-files-found }}