Files
common/minio/mc-cp-previous-artifacts/action.yaml
2025-07-10 23:19:37 -07:00

94 lines
3.0 KiB
YAML

name: mc-cp-previous-artifacts
description: "Copy previous artifacts to MinIO."
inputs:
workflowPattern:
description: "Pattern of the workflow name to match. Supports wildcard or RegEx. Default: ${{ github.event.repository.workflow }}"
required: true
default: "${{ github.event.repository.workflow }}"
artifactPattern:
description: "Pattern of the artifacts to match. Supports wildcard or RegEx. Default: *"
required: true
default: "*"
password:
description: "Credentials to use for Gitea. If not specified, the GitHub/Gitea token will be used."
required: true
default: "${{ github.token }}"
nugetPasswords:
description: "Credentials to use for NuGet. If not specified, the password will be used."
required: true
default: ""
unzipDir:
description: "Directory to unzip the artifacts into. If not specified, the artifacts will not be unzipped."
required: false
default: ""
unzipPattern:
description: "Pattern of the files to upload from the unzipped artifacts."
required: false
default: "*"
destBucket:
description: "Destination bucket."
required: true
default: ""
useRepoAsBucket:
description: "Use the repository name as the bucket name appended to the destBucket. Default: false"
required: false
default: "false"
minioAccessKey:
description: "S3 access key."
required: true
minioSecretKey:
description: "S3 secret key."
required: true
alias:
description: "S3 alias."
required: true
default: "minio"
url:
description: "S3 url."
required: true
default: https://minio.studiowhy.net
recursive:
description: "Is the command recursive."
required: true
default: "true"
version:
description: "Version of the file to upload."
required: true
runs:
using: "composite"
steps:
- uses: act/common/gitea/download-previous-artifact@master
id: download
with:
workflowPattern: ${{ inputs.workflowPattern }}
artifactPattern: ${{ inputs.artifactPattern }}
password: ${{ inputs.password }}
nugetPasswords: ${{ inputs.nugetPasswords || inputs.password }}
unzipDir: ${{ inputs.unzipDir }}
- name: "Get Bucket name."
id: bucket
run: |
BUCKET="${{ inputs.destBucket }}"
if [[ "${{ inputs.useRepoAsBucket }}" == "true" ]]; then
REPO="${{ github.repository }}"
REPO="${REPO##*/}"
if [[ -n "$BUCKET" ]]; then
BUCKET="$BUCKET-$REPO"
else
BUCKET="$REPO"
fi
fi
echo "destBucket=$BUCKET" >> "$GITHUB_OUTPUT"
shell: bash
- name: "Copy files to MinIO."
uses: act/common/minio/mc-cp@master
with:
target: ${{ steps.download.outputs.downloadedArtifactPath }}
dest: "${{ inputs.alias }}/${{ steps.bucket.outputs.destBucket }}"
minioAccessKey: ${{ inputs.minioAccessKey }}
minioSecretKey: ${{ inputs.minioSecretKey }}
alias: ${{ inputs.alias }}
url: ${{ inputs.url }}
recursive: ${{ inputs.recursive }}
tags: "version=${{ inputs.version }}"