Skip to content

Commit 6768f57

Browse files
author
Oleg
committed
Compute image name inside reusable workflow
1 parent 8b5667c commit 6768f57

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

.github/workflows/build-image.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ name: Build test harness image
33
on:
44
workflow_call:
55
inputs:
6-
image-name:
7-
type: string
8-
required: true
9-
description: 'Name for the image to build'
106
publish-image:
117
type: boolean
128
default: false
@@ -46,14 +42,20 @@ jobs:
4642
- name: Install bowtie
4743
uses: bowtie-json-schema/bowtie@main
4844

45+
- name: Compute implementation name
46+
id: impl
47+
env:
48+
GH_REPOSITORY: ${{ github.repository }}
49+
run: echo "name=$(echo ${GH_REPOSITORY} | awk -F '/' '{print $2}')" >> $GITHUB_OUTPUT
50+
4951
- name: Build
5052
id: build_image
5153
uses: redhat-actions/buildah-build@v2
5254
with:
5355
context: '.'
5456
containerfiles: |
5557
Dockerfile
56-
image: ${{ inputs.image-name }}
58+
image: ${{ steps.impl.outputs.name }}
5759
tags: ${{ github.sha }} ${{ inputs.is-latest && 'latest' || '' }}
5860
archs: amd64, arm64
5961

.github/workflows/build.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
runs-on: ubuntu-latest
2222
outputs:
2323
latest-version: ${{ steps.version.outputs.value }}
24-
implementation-name: ${{ steps.impl.outputs.name }}
2524
steps:
2625

2726
- name: Install bowtie
@@ -55,7 +54,6 @@ jobs:
5554

5655
uses: ./.github/workflows/build-image.yml
5756
with:
58-
image-name: ${{ needs.meta.outputs.implementation-name }}
5957
is-latest: ${{ github.ref == 'refs/heads/main' }}
6058
publish-image: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
6159

@@ -128,6 +126,5 @@ jobs:
128126

129127
uses: ./.github/workflows/build-image.yml
130128
with:
131-
image-name: ${{ needs.meta.outputs.implementation-name }}
132129
is-latest: ${{ github.event.pull_request.base.ref == 'main' }}
133130
publish-image: true

0 commit comments

Comments
 (0)