Split up actions better.

This commit is contained in:
2025-07-10 22:12:39 -07:00
parent 3d72a9d312
commit 0ea5eddf63
2 changed files with 99 additions and 15 deletions

View File

@@ -0,0 +1,96 @@
name: github-download-previous-artifact
description: "Download a single artifact from a previous Workflow run."
inputs:
host:
description: "Gitea host to query."
required: true
default: "${{ github.server_url }}"
username:
description: "Gitea user to query with."
required: true
default: "${{ github.actor }}"
password:
description: "Credentials to use for Gitea. If not specified, the GitHub/Gitea token will be used."
required: true
default: "${{ github.token }}"
repoFullName:
description: "The full name of the repository that ran the workflow to download from. Default: ${{ github.repository }}"
required: true
default: "${{ github.repository }}"
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: "*"
branchPattern:
description: "Branch of the workflow to match. Supports wildcard or RegEx. Default: ${{ github.ref }}"
required: false
default: "${{ github.ref }}"
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: "*"
deleteAfterUnzip:
description: "Whether to delete the artifacts after unzipping. Default: false"
required: false
default: "false"
nugetSources:
description: "List of additional NuGet sources to use."
required: false
default: "${{ github.server_url }}/api/packages/FORK/nuget/index.json"
nugetUsernames:
description: "List of additional NuGet usernames to use."
required: false
default: "${{ github.actor }}"
nugetPasswords:
description: "List of additional NuGet passwords to use."
required: false
default: "${{ github.token }}"
outputs:
downloadedArtifactName:
description: "The downloaded artifacts names"
value: ${{ steps.artifacts.outputs.fileName }}
downloadedArtifactPath:
description: "The downloaded artifact paths."
value: ${{ steps.artifacts.outputs.filePath }}
runs:
using: "composite"
steps:
- uses: act/common/gitea/download-previous-artifacts@master
id: download
with:
host: ${{ inputs.host }}
username: ${{ inputs.username }}
password: ${{ inputs.password }}
repoFullName: ${{ inputs.repoFullName }}
workflowPattern: ${{ inputs.workflowPattern }}
artifactPattern: ${{ inputs.artifactPattern }}
branchPattern: ${{ inputs.branchPattern }}
unzipDir: ${{ inputs.unzipDir }}
deleteAfterUnzip: ${{ inputs.deleteAfterUnzip }}
nugetSources: ${{ inputs.nugetSources }}
nugetUsernames: ${{ inputs.nugetUsernames }}
nugetPasswords: ${{ inputs.nugetPasswords || inputs.password }}
- name: "Get the file to upload."
id: artifacts
run: |
if [[ -n "${{ inputs.unzipDir }}" ]]; then
echo "Using unzipPattern: ${{ inputs.unzipPattern }}"
FIRST_DIR=$(echo '${{ steps.download.outputs.downloadedArtifactDirs }}' | tr ',' '\n' | head -n 1)
FILE_PATH=$(ls -1 ${FIRST_DIR}/*${{ inputs.unzipPattern }} | head -n 1)
echo "filePath=$FILE_PATH" >> "$GITHUB_OUTPUT"
else
echo "Using first downloaded artifact path"
FILE_PATH=$(echo '${{ steps.download.outputs.downloadedArtifactPaths }}' | tr ',' '\n' | head -n 1)
echo "filePath=$FILE_PATH" >> "$GITHUB_OUTPUT"
fi
FILE_NAME=$(basename "$FILE_PATH")
echo "fileName=$FILE_NAME" >> "$GITHUB_OUTPUT"
shell: bash

View File

@@ -24,7 +24,7 @@ inputs:
unzipPattern: unzipPattern:
description: "Pattern of the files to upload from the unzipped artifacts." description: "Pattern of the files to upload from the unzipped artifacts."
required: false required: false
default: "" default: "*"
account: account:
description: "Itch.io account name." description: "Itch.io account name."
required: true required: true
@@ -44,7 +44,7 @@ inputs:
runs: runs:
using: "composite" using: "composite"
steps: steps:
- uses: act/common/gitea/download-previous-artifacts@master - uses: act/common/gitea/download-previous-artifact@master
id: download id: download
with: with:
workflowPattern: ${{ inputs.workflowPattern }} workflowPattern: ${{ inputs.workflowPattern }}
@@ -52,22 +52,10 @@ runs:
password: ${{ inputs.password }} password: ${{ inputs.password }}
nugetPasswords: ${{ inputs.nugetPasswords || inputs.password }} nugetPasswords: ${{ inputs.nugetPasswords || inputs.password }}
unzipDir: ${{ inputs.unzipDir }} unzipDir: ${{ inputs.unzipDir }}
- name: "Get the file to upload."
id: artifacts
run: |
if [[ -n "${{ inputs.unzipDir }}" ]]; then
echo "Using unzipPattern: ${{ inputs.unzipPattern }}"
FIRST_DIR=$(echo '${{ steps.download.outputs.downloadedArtifactDirs }}' | tr ',' '\n' | head -n 1)
echo "file=$(ls -1 ${FIRST_DIR}/*${{ inputs.unzipPattern }} | head -n 1)" >> "$GITHUB_OUTPUT"
else
echo "Using first downloaded artifact path"
echo "file=$(echo '${{ steps.download.outputs.downloadedArtifactPaths }}' | tr ',' '\n' | head -n 1)" >> "$GITHUB_OUTPUT"
fi
shell: bash
- name: "Copy files to Itch.io." - name: "Copy files to Itch.io."
uses: act/common/itchio/butler-push@master uses: act/common/itchio/butler-push@master
with: with:
file: ${{ steps.artifacts.outputs.file }} file: ${{ steps.download.outputs.downloadedArtifactPath }}
account: ${{ inputs.account }} account: ${{ inputs.account }}
project: ${{ inputs.project }} project: ${{ inputs.project }}
channel: ${{ inputs.channel }} channel: ${{ inputs.channel }}