fedora40 #98
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: fedora40 | |
on: | |
pull_request: | |
push: | |
paths: | |
- 'fedora40/**' | |
- '.github/workflows/fedora40.yml' | |
schedule: | |
- cron: '10 6,15 * * 1,6' | |
workflow_dispatch: | |
permissions: write-all | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
# Test the image builds and works correctly. | |
test: | |
name: Test fedora40 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04] | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
- name: Test building image. | |
run: cd fedora40 && docker build -t fedora40 . | |
- name: Run the built image. | |
run: docker run --name test-container -d --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:rw fedora40 | |
# If on master branch, build and release image. | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
${{ github.repository }}:fedora40 | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GHCR | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push image. | |
uses: docker/build-push-action@v5 | |
with: | |
context: fedora40/ | |
sbom: true | |
provenance: mode=max | |
file: fedora40/Dockerfile | |
platforms: linux/amd64, linux/arm64, linux/ppc64le, linux/s390x | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: | | |
${{ github.repository }}:fedora40, ${{ github.repository }}:40 | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Docker Scout | |
id: docker-scout | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: docker/scout-action@v1.6.3 | |
with: | |
command: quickview,cves,recommendations,sbom,environment | |
image: ${{ steps.meta.outputs.tags }} | |
environment: prod | |
organization: shadownet | |
only-severities: critical,high,medium | |
exit-code: true | |
only-fixed: true |