using actions to publish java artefact to maven central


I would like to release a library (navikt/bidrag-commons) to maven central and need to write a ci/cd pipeline.

I am searching for an example or an instruction of how to do that using github actions, but am struggeling to find good sources.

Is it possible to write an easy step-by-step instruction of how to accomplish this?


the user guide says that action files must be *.yml OR *.yaml.

it fails if the file is named action. yaml. which is too bad as i because i prefer yaml over yml…


there is no examples of how an action file is supposed to look like (except short snippets of code which does not explain all properties). my action fails when i try to run maven via docker.

my action file:

the error message:

##[error](Line: 18, Col: 7): Unexpected value ‘docker run -it -rm --name ${ inputs.artifact} -v ${ inputs.workpath }:/usr/src/maven ${ inputs.image } mvn -B package’

3##[error](Line: 18, Col: 7): Unrecognized named-value: ‘inputs’. Located at position 1 within expression: inputs.artifact

4##[error](Line: 18, Col: 7): Unexpected value ‘docker run -it -rm --name ${{ inputs.artifact}} -v ${{ inputs.workpath }}:/usr/src/maven ${{ inputs.image }} mvn -B package’

5##[error]Unexpected type ‘StringToken’ encountered while reading ‘runs’. The type ‘MappingToken’ was expected.

6##[error]Fail to load /home/runner/work/bidrag-commons/bidrag-commons/./.github/actions/maven-ci/action.yml

why cannot github find the inputs object? what is a ‘StringToken’ and ‘MappingToken’?