add_git_labels adds opencontainers labels

Setting the INPUT_ADD_GIT_LABELS env var to true adds labels as per the
opencontainers standard: https://github.com/opencontainers/image-spec/blob/master/annotations.md

The 3 labels supported are:
- org.opencontainers.image.created
- org.opencontainers.image.source
- org.opencontainers.image.revision

Signed-off-by: Nick Adcock <nick.adcock@docker.com>
This commit is contained in:
Nick Adcock 2020-03-06 13:51:14 +00:00
parent ff1bd84857
commit 720bee6354
2 changed files with 6 additions and 5 deletions

View File

@ -124,14 +124,15 @@ labels: label_name_1=label_value_1,label_name_2=label_value_2
Boolean value. Defaults to `false`.
Adds labels with git repository information to the built image.
Adds labels with git repository information to the built image based on the standards set out in https://github.com/opencontainers/image-spec/blob/master/annotations.md.
The labels are:
|Label key|Example value|Description|
|---|---|---|
|`com.docker.github-actions-actor`|`my-username`|The actor that kicked off the workflow. For example this could be the username of the user that did the git push.|
|`com.docker.github-actions-sha`|`676cae2f85471aeff6776463c72881ebd902dcf9`|Full git SHA of the current commit.|
|`org.opencontainers.image.created`|`2020-03-06T23:00:00Z`|Date and time on which the image was built (string, date-time as defined by RFC 3339).|
|`org.opencontainers.image.source`|`https://github.com/myorg/myrepository`|URL to this repository.|
|`org.opencontainers.image.revision`|`676cae2f85471aeff6776463c72881ebd902dcf9`|The full git sha of this commit.|
### `push`

View File

@ -3,7 +3,7 @@ description: Builds and pushes Docker images and will log in to a Docker registr
author: Docker
runs:
using: docker
image: docker://docker/github-actions:v0.0.1
image: docker://docker/github-actions:v0.1
args:
- build-push
inputs:
@ -51,7 +51,7 @@ inputs:
description: Comma-delimited list of labels to add to the built image
required: false
add_git_labels:
description: Adds labels with git repo info to the built image
description: Adds labels with git repository information to the built image
required: false
default: false
push: