Add output image-with-tag

Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
divyansh42 2021-09-01 11:29:51 +05:30
parent b82756135c
commit a7897e7520
9 changed files with 18 additions and 3 deletions

View file

@ -48,6 +48,7 @@ jobs:
run: | run: |
echo "Image: ${{ steps.build_image.outputs.image }}" echo "Image: ${{ steps.build_image.outputs.image }}"
echo "Tags: ${{ steps.build_image.outputs.tags }}" echo "Tags: ${{ steps.build_image.outputs.tags }}"
echo "Tagged Image: ${{ steps.build_image.outputs.image-with-tag }}"
# Check if image is build # Check if image is build
- name: Check images created - name: Check images created

View file

@ -58,6 +58,7 @@ jobs:
run: | run: |
echo "Image: ${{ steps.build_image.outputs.image }}" echo "Image: ${{ steps.build_image.outputs.image }}"
echo "Tags: ${{ steps.build_image.outputs.tags }}" echo "Tags: ${{ steps.build_image.outputs.tags }}"
echo "Tagged Image: ${{ steps.build_image.outputs.image-with-tag }}"
- name: Check images created - name: Check images created
run: buildah images | grep '${{ env.IMAGE_NAME }}' run: buildah images | grep '${{ env.IMAGE_NAME }}'

View file

@ -91,6 +91,7 @@ jobs:
run: | run: |
echo "Image: ${{ steps.build_image.outputs.image }}" echo "Image: ${{ steps.build_image.outputs.image }}"
echo "Tags: ${{ steps.build_image.outputs.tags }}" echo "Tags: ${{ steps.build_image.outputs.tags }}"
echo "Tagged Image: ${{ steps.build_image.outputs.image-with-tag }}"
# Check if image is build # Check if image is build
- name: Check images created - name: Check images created

View file

@ -62,6 +62,9 @@ For example, `spring-image`.
`tags`: A list of the tags that were created, separated by spaces.<br> `tags`: A list of the tags that were created, separated by spaces.<br>
For example, `latest ${{ github.sha }}`. For example, `latest ${{ github.sha }}`.
`image-with-tag`: The name of the image tagged with the first tag present.<br>
For example, `spring-image:v1`
<a id="build-types"></a> <a id="build-types"></a>
## Build Types ## Build Types

View file

@ -63,6 +63,8 @@ outputs:
description: 'Name of the image built' description: 'Name of the image built'
tags: tags:
description: 'List of the tags that were created, separated by spaces' description: 'List of the tags that were created, separated by spaces'
image-with-tag:
description: 'Name of the image tagged with the first tag present'
runs: runs:
using: 'node12' using: 'node12'
main: 'dist/index.js' main: 'dist/index.js'

4
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -106,6 +106,12 @@ export enum Outputs {
* Default: None. * Default: None.
*/ */
IMAGE = "image", IMAGE = "image",
/**
* Name of the image tagged with the first tag present
* Required: false
* Default: None.
*/
IMAGE_WITH_TAG = "image-with-tag",
/** /**
* List of the tags that were created, separated by spaces * List of the tags that were created, separated by spaces
* Required: false * Required: false

View file

@ -54,6 +54,7 @@ export async function run(): Promise<void> {
} }
core.setOutput(Outputs.IMAGE, image); core.setOutput(Outputs.IMAGE, image);
core.setOutput(Outputs.TAGS, tags); core.setOutput(Outputs.TAGS, tags);
core.setOutput(Outputs.IMAGE_WITH_TAG, `${image}:${tagsList[0]}`);
} }
async function doBuildUsingDockerFiles( async function doBuildUsingDockerFiles(