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

61
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,61 @@
name: Build Container Images
on:
push:
branches: [ "main" ]
schedule:
- cron: "0 4 * * *"
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_PREFIX: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: 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@v3
- name: Log into registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_PREFIX }}/${{ matrix.image.name }}
tags: |
type=raw,value=latest
type=raw,value={{date 'YYYYMMDD'}}
- name: Build and push ${{ matrix.image.name }}
uses: docker/build-push-action@v5
with:
context: ${{ matrix.image.context }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max