Skip to content

Auto update Fedora CoreOS ZFS build #735

Auto update Fedora CoreOS ZFS build

Auto update Fedora CoreOS ZFS build #735

Workflow file for this run

name: Auto update Fedora CoreOS ZFS build
on:
push:
branches: [ master ]
paths-ignore:
- '**/README.md'
schedule:
- cron: '48 8 * * *'
workflow_dispatch:
inputs:
force_build:
description: 'Force build even if no new version is available'
required: false
default: false
type: boolean
jobs:
version_check:
runs-on: ubuntu-22.04
outputs:
pushed_new_version: ${{ steps.commit_new_version.outputs.pushed }}
fcos_version: ${{ steps.fetch_version.outputs.fcos_version }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get the latest version of Fedora CoreOS
id: fetch_version
run: |
skopeo inspect docker://quay.io/fedora/fedora-coreos:stable | jq -r '.Labels."org.opencontainers.image.version"' > fcos_version
if [[ $(cat fcos_version) =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
echo "FCOS_VERSION=$(cat fcos_version)" >> $GITHUB_ENV
echo "fcos_version=$(cat fcos_version)" >> $GITHUB_OUTPUT
else
echo "Unexpected version format: \"$(cat fcos_version)\"" >> $GITHUB_ENV
exit 1
fi
- name: Add & Commit
id: commit_new_version
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9.1.4
with:
message: 'Version updated to: ${{ env.FCOS_VERSION }}'
build:
runs-on: ubuntu-22.04
needs: version_check
permissions:
packages: write
contents: read
attestations: write
id-token: write
if: needs.version_check.outputs.pushed_new_version == 'true' || github.event.inputs.force_build == 'true'
timeout-minutes: 360
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Export version to variable
run: |
export FCOS_VERSION=${{ needs.version_check.outputs.fcos_version }}
export FEDORA_VERSION=$(cut -d '.' -f 1 <(echo $FCOS_VERSION))
echo "FCOS_VERSION=$FCOS_VERSION" >> $GITHUB_ENV
echo "FEDORA_VERSION=$FEDORA_VERSION" >> $GITHUB_ENV
shell: bash
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
id: push
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
file: ./layering-examples/build-zfs-module/Containerfile
build-args: |
BUILDER_VERSION=${{ env.FEDORA_VERSION }}
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/fcos-zfs:stable
ghcr.io/${{ github.repository_owner }}/fcos-zfs:${{ env.FEDORA_VERSION }}
ghcr.io/${{ github.repository_owner }}/fcos-zfs:${{ env.FCOS_VERSION }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ghcr.io/${{ github.repository_owner }}/fcos-zfs
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true