Skip to content

Build / Test / Push #14

Build / Test / Push

Build / Test / Push #14

Workflow file for this run

name: Build Image
on:
workflow_call:
workflow_dispatch:
env:
DOCKER_METADATA_SET_OUTPUT_ENV: 'true'
jobs:
debug:
runs-on: ubuntu-latest
steps:
- name: Debug environment
run: env | sort
build:
needs:
- debug
outputs:
tags: ${{ steps.meta.outputs.tags }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up Docker Compose
uses: docker/setup-compose-action@v1
- name: Produce sha-based image tag
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: type=sha
- name: Build the image
id: build
uses: docker/build-push-action@v6
with:
push: false
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Run the tests
run: bin/test
env:
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
DOCKER_APP_IMAGE: ${{ env.DOCKER_METADATA_OUTPUT_TAGS }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push the tested image
run: docker push "$DOCKER_APP_IMAGE"
env:
DOCKER_APP_IMAGE: ${{ steps.build.outputs.images }}