diff --git a/Containerfile b/Containerfile index 554d780..1271269 100644 --- a/Containerfile +++ b/Containerfile @@ -1,11 +1,26 @@ FROM docker.io/golang:1.21-alpine3.19 AS builder +RUN apk --no-cache add \ + git + ADD md2gmi.go /md2gmi.go RUN go build -o /md2gmi /md2gmi.go +ENV HUGO_VERSION=v0.121.1 +RUN git clone https://github.com/gohugoio/hugo.git /src/hugo +WORKDIR /src/hugo -FROM scratch +RUN git checkout $HUGO_VERSION +RUN go build -o /hugo -COPY --from=builder /md2gmi /md2gmi +FROM docker.io/alpine:3.19 -ENTRYPOINT ["/md2gmi"] +COPY --from=builder /md2gmi /bin/md2gmi +COPY --from=builder /hugo /bin/hugo + +RUN apk --no-cache add \ + make + +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yml b/action.yml index c8efa49..d2ba186 100644 --- a/action.yml +++ b/action.yml @@ -1,15 +1,10 @@ -name: "Markdown2Gemini" -description: "Simple conversion of a tree of markdown files to the gemini format." +name: "Hugo Builder" +description: "Build a hugo website from a makefile (runs 'make all' (md2gemini is included)" inputs: - input-dir: - description: "Path to the input directory" - required: true - output-dir: - description: "Path to the output directory" + working-dir: + description: "Working directory" required: true + default: "." runs: using: "docker" image: "Containerfile" - args: - - ${{ inputs.input-dir }} - - ${{ inputs.output-dir }} diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..c897f03 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +if [ -n "$INPUT_WORKING_DIR" ]; then + cd "$INPUT_WORKING_DIR" +fi + +make all