Added many, many more actions.
This commit is contained in:
12
tpl/tpl/Dockerfile
Normal file
12
tpl/tpl/Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
||||
FROM debian:stable-slim
|
||||
|
||||
ENV VERSION=v0.2.0
|
||||
|
||||
RUN apt-get update
|
||||
RUN apt-get install wget -y
|
||||
RUN wget https://github.com/bluebrown/go-template-cli/releases/download/$VERSION/tpl-linux-amd64 -O /usr/bin/tpl
|
||||
RUN chmod +x /usr/bin/tpl
|
||||
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
21
tpl/tpl/action.yaml
Normal file
21
tpl/tpl/action.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
name: tpl
|
||||
description: "Format a Go template file given yaml file."
|
||||
inputs:
|
||||
command:
|
||||
description: "Arguments to pass into tpl."
|
||||
required: false
|
||||
catchErrors:
|
||||
description: "Whether or not errors should be handled."
|
||||
required: false
|
||||
outputs:
|
||||
console:
|
||||
description: "The console output of the tpl command."
|
||||
exitCode:
|
||||
description: "How the program exited."
|
||||
runs:
|
||||
using: 'docker'
|
||||
image: 'Dockerfile'
|
||||
env:
|
||||
CATCH_ERRORS: ${{ inputs.catchErrors }}
|
||||
args:
|
||||
- ${{ inputs.command }}
|
||||
20
tpl/tpl/entrypoint.sh
Normal file
20
tpl/tpl/entrypoint.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
#See https://github.com/bluebrown/go-template-cli
|
||||
ARGS="$@"
|
||||
|
||||
OUTPUT=$(sh -c "tpl $ARGS")
|
||||
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
|
||||
Reference in New Issue
Block a user