diff --git a/.forgejo/workflows/demo.yml b/.forgejo/workflows/demo.yml index da3569f..b09a87c 100644 --- a/.forgejo/workflows/demo.yml +++ b/.forgejo/workflows/demo.yml @@ -5,8 +5,10 @@ jobs: name: debug steps: - uses: actions/checkout@v4 - - name: build - run: | - apt-get install -y hugo - hugo + - name: hello world action step + uses: ./actions/hello + with: + who-to-greet: 'lubi' + - name: Get the output time + run: echo "The time was ${{ steps.hello.outputs.time }}" diff --git a/actions/hello/Dockerfile b/actions/hello/Dockerfile new file mode 100644 index 0000000..9a59127 --- /dev/null +++ b/actions/hello/Dockerfile @@ -0,0 +1,9 @@ +# Container image that runs your code +FROM alpine:edge + +# Copies your code file from your action repository to the filesystem path `/` of the container +COPY entrypoint.sh /entrypoint.sh + +# Code file to execute when the docker container starts up (`entrypoint.sh`) +ENTRYPOINT ["/entrypoint.sh"] + diff --git a/actions/hello/action.yml b/actions/hello/action.yml new file mode 100644 index 0000000..da7c35e --- /dev/null +++ b/actions/hello/action.yml @@ -0,0 +1,17 @@ +# action.yml +name: 'Hello World' +description: 'Greet someone and record the time' +inputs: + who-to-greet: # id of input + description: 'Who to greet' + required: true + default: 'World' +outputs: + time: # id of output + description: 'The time we greeted you' +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.who-to-greet }} + diff --git a/actions/hello/entrypoint.sh b/actions/hello/entrypoint.sh new file mode 100755 index 0000000..52264ae --- /dev/null +++ b/actions/hello/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh -l + +echo "Hello $1" +time=$(date) +echo "time=$time" >> $GITHUB_OUTPUT + +exit 0