Update GitHub Actions workflow for Docker builds

This commit is contained in:
2026-02-12 17:23:32 +09:00
committed by GitHub
parent b7a5da840f
commit 8bfa667987

View File

@@ -1,10 +1,15 @@
name: Build Container Images
on:
push:
branches: [ "main" ]
schedule:
- cron: "0 4 * * *"
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_PREFIX: ${{ github.repository }}
jobs:
build:
@@ -12,17 +17,25 @@ jobs:
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false
matrix:
image:
- name: rpmbuild
context: ./rpmbuild
- name: kernel
context: ./kernel
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
- name: Log into registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
@@ -30,17 +43,17 @@ jobs:
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.image.name }}
tags: |
type=raw,value=latest
type=raw,value={{date 'YYYYMMDD'}}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
- name: Build and push ${{ matrix.image.name }}
uses: docker/build-push-action@v5
with:
context: .
context: ${{ matrix.image.context }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}