Skip to content

add debug image publishing #2

add debug image publishing

add debug image publishing #2

Workflow file for this run

on:

Check failure on line 1 in .github/workflows/_container.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/_container.yml

Invalid workflow file

(Line: 67, Col: 13): The identifier 'meta' may not be used more than once within the same scope.
workflow_call:
inputs:
publish:
type: boolean
description: If true, pushes image to container registry
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Need this to get version number from last tag
fetch-depth: 0
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Docker Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and export to Docker local cache
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: false
with:
context: .
# Need load and tags so we can test it below
load: true
tags: tag_for_testing
- name: Test cli works in cached runtime image
run: docker run --rm tag_for_testing --version
- name: Create tags for publishing image
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Push cached image to container registry
if: inputs.publish && github.ref_type == 'tag'
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: false
# This does not build the image again, it will find the image in the
# Docker cache and publish it
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Create tags for publishing debug image
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}-debug
tags: |
type=ref,event=tag
type=raw,value=latest
- name: Push cached debug image to container registry
if: inputs.publish && github.ref_type == 'tag'
uses: docker/build-push-action@v6
env:
DOCKER_BUILD_RECORD_UPLOAD: false
# This does not build the image again, it will find the image in the
# Docker cache and publish it
with:
context: .
push: true
target: developer
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}