From 3d72a9d312ebb9c8aff08f0b7a22414937558120 Mon Sep 17 00:00:00 2001 From: Scion Date: Thu, 10 Jul 2025 21:52:25 -0700 Subject: [PATCH] Added new upload action. --- .../action.yaml | 75 +++++++++++++++++++ itchio/butler-push/action.yaml | 6 +- 2 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 itchio/butler-push-previous-artifacts/action.yaml diff --git a/itchio/butler-push-previous-artifacts/action.yaml b/itchio/butler-push-previous-artifacts/action.yaml new file mode 100644 index 0000000..c6905ca --- /dev/null +++ b/itchio/butler-push-previous-artifacts/action.yaml @@ -0,0 +1,75 @@ +name: butler-push-previous-artifacts +description: "Upload previous workflow artifacts to butler." +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: "" + account: + description: "Itch.io account name." + required: true + project: + description: "Itch.io project name." + required: true + channel: + description: "Itch.io channel name." + required: true + apiKey: + description: "Itch.io API key." + required: true + version: + description: "The version of the file to upload." + required: true + default: "" +runs: + using: "composite" + steps: + - uses: act/common/gitea/download-previous-artifacts@master + id: download + with: + workflowPattern: ${{ inputs.workflowPattern }} + artifactPattern: ${{ inputs.artifactPattern }} + password: ${{ inputs.password }} + nugetPasswords: ${{ inputs.nugetPasswords || inputs.password }} + 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." + uses: act/common/itchio/butler-push@master + with: + file: ${{ steps.artifacts.outputs.file }} + account: ${{ inputs.account }} + project: ${{ inputs.project }} + channel: ${{ inputs.channel }} + apiKey: ${{ inputs.apiKey }} + version: ${{ inputs.version }} diff --git a/itchio/butler-push/action.yaml b/itchio/butler-push/action.yaml index b687447..ba5bfb2 100644 --- a/itchio/butler-push/action.yaml +++ b/itchio/butler-push/action.yaml @@ -5,13 +5,13 @@ inputs: description: "Input file or folder to upload." required: true account: - description: "ItchIo account name." + description: "Itch.io account name." required: true project: - description: "ItchIo project name." + description: "Itch.io project name." required: true channel: - description: "ItchIo channel name." + description: "Itch.io channel name." required: true apiKey: description: "Itch.io API key."