Skip to content

✏️ fix typo

✏️ fix typo #7

Workflow file for this run

name: Library
on:
push:
branches:
- main
paths:
- '_library/**'
tags:
- '*'
workflow_dispatch:
env:
REGISTRY: ghcr.io
jobs:
collect:
name: Collect
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Find directories with Dockerfile
id: set-matrix
run: |
dirs=$(find _library -maxdepth 2 -name "Dockerfile" -exec dirname {} \; | sed 's|_library/||' | jq -R -s -c 'split("\n")[:-1]')
echo "matrix=$dirs" >> $GITHUB_OUTPUT
echo "Found directories: $dirs"
build-and-push:
name: Build and Push
needs: collect
if: needs.collect.outputs.matrix != '[]'
runs-on: ubuntu-latest
strategy:
matrix:
dir: ${{ fromJson(needs.collect.outputs.matrix) }}
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}/library/${{ matrix.dir }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=ref,event=tag
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./_library/${{ matrix.dir }}
file: ./_library/${{ matrix.dir }}/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max