Skip to content

.github: workflows: build dkms packages #2

.github: workflows: build dkms packages

.github: workflows: build dkms packages #2

Workflow file for this run

name: Build kernel development containers
on:
push:
branches:
- 'intel/**'
paths:
- '.github/workflows/container.yml'
- 'container/**'
pull_request:
branches:
- 'intel/**'
paths:
- '.github/workflows/container.yml'
- 'container/**'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
image:
- rockylinux-8-kernel-devel
- ubuntu-22.04-kernel-devel
env:
image: ghcr.io/ofs/linux-dfl-backport/${{ matrix.image }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
# https://docs.docker.com/engine/reference/commandline/tag/#extended-description
# > A tag name must be valid ASCII and may contain lowercase and
# > uppercase letters, digits, underscores, periods and dashes.
# > A tag name may not start with a period or a dash and may
# > contain a maximum of 128 characters.
- name: Set image tag from git reference
run: |
ref=$(echo "$GITHUB_REF" | sed 's#^refs/\(\|heads/\|tags/\)##')
echo "tag=${ref//[^a-zA-Z0-9_.]/-}" >> "$GITHUB_ENV"
- name: Build kernel development image
run: docker build -t "$image:$tag" -f container/${{ matrix.image }}/Dockerfile .
- name: Log in to registry
if: github.event_name == 'push'
run: echo "$token" | docker login ghcr.io -u "$GITHUB_REPOSITORY_OWNER" --password-stdin
env:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Push image to registry
if: github.event_name == 'push'
run: docker image push "$image:$tag"