diff --git a/docker/action.yaml b/docker/action.yaml new file mode 100644 index 0000000..ef383b8 --- /dev/null +++ b/docker/action.yaml @@ -0,0 +1,33 @@ +name: build & push +description: build & push OCI container images to the Gitea registry + +inputs: + name: + description: image name + required: true + tags: + description: newline-separated list of tags to tag the image + required: true + containerfile: + description: target container file to build + required: false + default: Containerfile + +runs: + using: composite + steps: + - shell: bash + run: | + repo_url="${{ gitea.event.repository.html_url }}" + repo_host="${repo_url#https://}" + repo_host="${repo_host%%/*}" + docker login --username acti-bot --password ${ACTI_BOT_TOKEN} ${repo_host} + + docker build -f ${{ inputs.containerfile }} -t img-${{ gitea.run_id }} . + while IFS= read -r tag; do + [[ -z "$tag" ]] && continue + + image="${repo_host}/${{ gitea.repository }}/${{ inputs.name }}:$tag" + docker tag img-${{ gitea.run_id }} $image + docker push $image + done <<< "${{ inputs.tags }}"