test
This commit is contained in:
55
itchio/butler-push/action.yaml
Normal file
55
itchio/butler-push/action.yaml
Normal file
@@ -0,0 +1,55 @@
|
||||
name: butler-push
|
||||
description: "Upload files to butler."
|
||||
inputs:
|
||||
file:
|
||||
description: "Input file or folder to upload."
|
||||
required: true
|
||||
account:
|
||||
description: "ItchIo account name."
|
||||
required: true
|
||||
project:
|
||||
description: "ItchIo project name."
|
||||
required: true
|
||||
channel:
|
||||
description: "ItchIo channel name."
|
||||
required: true
|
||||
apiKey:
|
||||
description: "Itch.io API key."
|
||||
required: true
|
||||
verion:
|
||||
description: "The version of the file to upload."
|
||||
required: true
|
||||
default: ""
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "Get channel."
|
||||
id: channel
|
||||
run: bash ${{ github.action_path }}/get_channel.sh "${{ inputs.channel }}"
|
||||
shell: bash
|
||||
- name: "Build command."
|
||||
id: command
|
||||
run: |
|
||||
# Replace each space with a backslash and a space
|
||||
FILE="${{ inputs.file }}"
|
||||
FILE="${FILE// /\\ }"
|
||||
|
||||
DEST="${{ inputs.account }}/${{ inputs.project }}"
|
||||
CHANNEL="${{ steps.channel.outputs.channel }}"
|
||||
if [[ -n "$CHANNEL" ]]; then
|
||||
DEST="$DEST:$CHANNEL"
|
||||
fi
|
||||
|
||||
COMMAND="push $FILE $DEST"
|
||||
|
||||
VERSION="${{ inputs.version }}"
|
||||
if [[ -n "$VERSION" ]]; then
|
||||
COMMAND="$COMMAND --userversion $VERSION"
|
||||
fi
|
||||
echo "command=$COMMAND" >> "$GITHUB_OUTPUT"
|
||||
shell: bash
|
||||
- name: "Copy files to/from S3."
|
||||
uses: act/common/itchio/butler@master
|
||||
with:
|
||||
command: ${{ steps.command.outputs.command }}
|
||||
apiKey: ${{ inputs.apiKey }}
|
||||
29
itchio/butler-push/get_channel.sh
Normal file
29
itchio/butler-push/get_channel.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
BUTLER_CHANNEL="$1"
|
||||
|
||||
CHANNEL=$(echo "$BUTLER_CHANNEL" | awk '{print tolower($0)}')
|
||||
case $CHANNEL in
|
||||
"windows")
|
||||
CHANNEL=win64
|
||||
;;
|
||||
"windows32bit")
|
||||
CHANNEL=win32
|
||||
;;
|
||||
"mac")
|
||||
CHANNEL=osx
|
||||
;;
|
||||
"ios")
|
||||
CHANNEL=ios
|
||||
;;
|
||||
"linux")
|
||||
CHANNEL=linux
|
||||
;;
|
||||
"android")
|
||||
CHANNEL=android
|
||||
;;
|
||||
"webgl")
|
||||
CHANNEL=webgl
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "channel=$CHANNEL" #>> "$GITHUB_OUTPUT"
|
||||
18
itchio/butler/Dockerfile
Normal file
18
itchio/butler/Dockerfile
Normal file
@@ -0,0 +1,18 @@
|
||||
# Container image that runs your code
|
||||
FROM debian:stable-slim
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
unzip \
|
||||
curl
|
||||
|
||||
RUN curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default
|
||||
|
||||
RUN unzip butler.zip && \
|
||||
mv butler /usr/local/bin/butler && \
|
||||
rm butler.zip
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
25
itchio/butler/action.yaml
Normal file
25
itchio/butler/action.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
name: butler
|
||||
description: "Run butler client commands."
|
||||
inputs:
|
||||
command:
|
||||
description: "Arguments to pass into butler."
|
||||
required: true
|
||||
apiKey:
|
||||
description: "Itch.io API key."
|
||||
required: true
|
||||
catchErrors:
|
||||
description: "Whether or not errors should be handled."
|
||||
required: false
|
||||
outputs:
|
||||
console:
|
||||
description: "The console output of the butler command."
|
||||
exitCode:
|
||||
description: "How the program exited."
|
||||
runs:
|
||||
using: docker
|
||||
image: Dockerfile
|
||||
env:
|
||||
CATCH_ERRORS: ${{ inputs.catchErrors }}
|
||||
BUTLER_API_KEY: ${{ inputs.apiKey }}
|
||||
args:
|
||||
- ${{ inputs.command }}
|
||||
20
itchio/butler/entrypoint.sh
Normal file
20
itchio/butler/entrypoint.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
ARGS="$@"
|
||||
|
||||
exec 5>&1
|
||||
OUTPUT=$(bash -c "butler $ARGS" | tee /dev/fd/5)
|
||||
RESULT=$?
|
||||
|
||||
#Output multiline strings.
|
||||
#https://trstringer.com/github-actions-multiline-strings/
|
||||
if [[ -n "$OUTPUT" ]]; then
|
||||
echo "console<<EOF" >> "$GITHUB_OUTPUT"
|
||||
echo "$OUTPUT" >> "$GITHUB_OUTPUT"
|
||||
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
echo "exitCode=$RESULT" >> "$GITHUB_OUTPUT"
|
||||
|
||||
if [[ "$CATCH_ERRORS" != "true" ]]; then
|
||||
exit $RESULT
|
||||
fi
|
||||
@@ -23,7 +23,7 @@ inputs:
|
||||
required: false
|
||||
outputs:
|
||||
console:
|
||||
description: "The console output of the aws command."
|
||||
description: "The console output of the mc command."
|
||||
exitCode:
|
||||
description: "How the program exited."
|
||||
runs:
|
||||
|
||||
Reference in New Issue
Block a user