Add output and logging to container

This commit is contained in:
Nick Alteen 2023-09-01 14:10:18 -04:00
parent dd2f5f03b8
commit fd8511c33b
3 changed files with 36 additions and 14 deletions

View File

@ -1,7 +1,11 @@
FROM alpine:3.10
# Set the base image to use for subsequent instructions
FROM alpine:3.18
COPY LICENSE README.md /
# Set the working directory inside the container
WORKDIR /usr/src
COPY entrypoint.sh /entrypoint.sh
# Copy any source file(s) required for the action
COPY entrypoint.sh .
ENTRYPOINT ["/entrypoint.sh"]
# Configure the container to be run as an executable
ENTRYPOINT ["/usr/src/entrypoint.sh"]

View File

@ -1,12 +1,21 @@
name: 'Container Action Template'
description: 'Get started with Container actions'
author: 'GitHub'
name: 'The name of your action here'
description: 'Provide a description here'
author: 'Your name or organization here'
# Define your inputs here.
inputs:
myInput:
description: 'Input to use'
default: 'world'
who-to-greet:
description: 'Your input description here'
required: true
default: 'World'
# Define your outputs here.
outputs:
greeting:
description: 'Your output description here'
runs:
using: 'docker'
image: 'Dockerfile'
using: docker
image: Dockerfile
args:
- ${{ inputs.myInput }}
- ${{ inputs.who-to-greet }}

View File

@ -1,3 +1,12 @@
#!/bin/sh -l
echo "hello $1"
# Use INPUT_<INPUT_NAME> to get the value of an input
GREETING="Hello, $INPUT_WHO_TO_GREET!"
# Use workflow commands to do things like set debug messages
echo "::notice file=entrypoint.sh,line=7::$GREETING"
# Write outputs to the $GITHUB_OUTPUT file
echo "greeting=$GREETING" >> "$GITHUB_OUTPUT"
exit 0