Skip to content

Migrate stable to Fedora 40 #611

Migrate stable to Fedora 40

Migrate stable to Fedora 40 #611

Workflow file for this run

name: Build image
on:
schedule:
- cron: '20 20 * * *' # 8:20pm everyday
pull_request:
branches:
- main
paths:
- .github/workflows/*.yml
- Containerfile*
- cosign.pub
- rootfs/**
push:
branches:
- main
paths:
- .github/workflows/*.yml
- Containerfile*
- cosign.pub
- rootfs/**
workflow_dispatch:
env:
IMAGE_NAME: ${{ github.event.repository.name }}
REGISTRY_URL: ghcr.io
REGISTRY_USERNAME: ${{ github.repository_owner }}
REGISTRY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false
matrix:
major_version: [38, 39, 40]
include:
- major_version: 38
is_latest: false
is_stable: false
- major_version: 39
is_latest: false
is_stable: false
- major_version: 40
is_latest: true
is_stable: true
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log into registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY_URL }}
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY_URL }}/${{ env.REGISTRY_USERNAME }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: |
type=semver,pattern={{version}}
type=sha,prefix=sha256-
- name: Extract Docker PR tag
if: github.event_name == 'pull_request'
id: meta_pr
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY_URL }}/${{ env.REGISTRY_USERNAME }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: |
type=ref,suffix=-${{ matrix.major_version }},event=pr
- name: Extract Docker date tag
if: github.event_name == 'schedule'
id: meta_date
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY_URL }}/${{ env.REGISTRY_USERNAME }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: |
type=schedule,prefix=${{ matrix.major_version }}-,pattern={{date 'YYYYMMDD'}}
- name: Extract Docker major version tag
if: |
github.event_name != 'pull_request' && matrix.major_version != ''
id: meta_version
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY_URL }}/${{ env.REGISTRY_USERNAME }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: |
type=raw,value=${{ matrix.major_version }}
- name: Extract Docker stable tag
if: |
github.event_name != 'pull_request' && matrix.is_stable == true
id: meta_stable
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY_URL }}/${{ env.REGISTRY_USERNAME }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: |
type=schedule,pattern={{date 'YYYYMMDD'}}
type=raw,value=stable
- name: Extract Docker latest tag
if: |
github.event_name != 'pull_request' && matrix.is_latest == true
id: meta_latest
uses: docker/metadata-action@v5
with:
images: |
${{ env.REGISTRY_URL }}/${{ env.REGISTRY_USERNAME }}/${{ env.IMAGE_NAME }}
flavor: |
latest=false
tags: |
type=raw,value=latest
- name: Build Image
id: build_image
uses: redhat-actions/buildah-build@v2
with:
containerfiles: |
./Containerfile.${{ matrix.major_version }}
tags: |
${{ steps.meta.outputs.tags }}
${{ steps.meta_pr.outputs.tags }}
${{ steps.meta_date.outputs.tags }}
${{ steps.meta_version.outputs.tags }}
${{ steps.meta_stable.outputs.tags }}
${{ steps.meta_latest.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
FEDORA_MAJOR_VERSION=${{ matrix.major_version }}
oci: false
- name: Push to container registries
uses: redhat-actions/push-to-registry@v2
id: push
with:
tags: ${{ steps.build_image.outputs.tags }}
extra-args: |
--disable-content-trust
- name: Install Cosign
uses: sigstore/cosign-installer@v3.1.2
- name: Sign container image
run: |
cosign sign -y --key env://COSIGN_PRIVATE_KEY ${{ env.REGISTRY_URL }}/${{ env.REGISTRY_USERNAME }}/${{ env.IMAGE_NAME }}@${TAGS}
env:
TAGS: ${{ steps.push.outputs.digest }}
COSIGN_PRIVATE_KEY: ${{ secrets.COSIGN_KEY }}
COSIGN_EXPERIMENTAL: false
- name: Echo outputs
run: |
echo "${{ toJSON(steps.push.outputs) }}"