|
| 1 | +############################################################################### |
| 2 | +# _ _ _ _ _____ _ |
| 3 | +# | | | | | | | | | __ \(_) |
| 4 | +# | | ___ | |__ _ __ | |_| |__ ___ | |__) |_ _ __ _ __ ___ _ __ |
| 5 | +# _ | |/ _ \| '_ \| '_ \ | __| '_ \ / _ \ | _ /| | '_ \| '_ \ / _ \ '__| |
| 6 | +# | |__| | (_) | | | | | | | | |_| | | | __/ | | \ \| | |_) | |_) | __/ | |
| 7 | +# \____/ \___/|_| |_|_| |_| \__|_| |_|\___| |_| \_\_| .__/| .__/ \___|_| |
| 8 | +# | | | | |
| 9 | +# |_| |_| |
| 10 | +# |
| 11 | +# Copyright (c) 2024 Claudio André <[email protected]> |
| 12 | +# |
| 13 | +# This program comes with ABSOLUTELY NO WARRANTY; express or implied. |
| 14 | +# |
| 15 | +# This program is free software: you can redistribute it and/or modify |
| 16 | +# it under the terms of the GNU General Public License as published by |
| 17 | +# the Free Software Foundation, as expressed in version 2, seen at |
| 18 | +# http://www.gnu.org/licenses/gpl-2.0.html |
| 19 | +############################################################################### |
| 20 | + |
| 21 | +--- |
| 22 | +name: CI Docker image |
| 23 | + |
| 24 | +"on": |
| 25 | + push: |
| 26 | + branches: [images] |
| 27 | + workflow_dispatch: |
| 28 | + |
| 29 | +env: |
| 30 | + REPO: ghcr.io/${{ github.repository_owner }}/john-ci |
| 31 | + |
| 32 | +permissions: read-all |
| 33 | +jobs: |
| 34 | + build: |
| 35 | + name: Build image |
| 36 | + runs-on: ubuntu-latest |
| 37 | + continue-on-error: true |
| 38 | + |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + include: |
| 42 | + - image-tag: fedora.latest |
| 43 | + dockerfile: Dockerfile.FedoraLatest |
| 44 | + - image-tag: fedora.flatpak |
| 45 | + dockerfile: Dockerfile.flatpak.package |
| 46 | + - image-tag: ubuntu.opencl |
| 47 | + dockerfile: Dockerfile.OpenCL |
| 48 | + - image-tag: ubuntu.devel |
| 49 | + dockerfile: Dockerfile.UbuntuDevel |
| 50 | + - image-tag: ubuntu.rolling |
| 51 | + dockerfile: Dockerfile.UbuntuRolling |
| 52 | + - image-tag: redhat.ubi8 |
| 53 | + dockerfile: Dockerfile.RHUbi8 |
| 54 | + |
| 55 | + permissions: |
| 56 | + packages: write |
| 57 | + contents: read |
| 58 | + |
| 59 | + outputs: |
| 60 | + image: ${{ steps.image.outputs.image }} |
| 61 | + digest: ${{ steps.build-and-push.outputs.digest }} |
| 62 | + |
| 63 | + steps: |
| 64 | + - name: Check out the repo |
| 65 | + uses: actions/checkout@v4 |
| 66 | + |
| 67 | + - name: Log in to GitHub Docker Registry |
| 68 | + uses: docker/login-action@v3 |
| 69 | + with: |
| 70 | + registry: ghcr.io |
| 71 | + username: ${{ github.repository_owner }} |
| 72 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 73 | + |
| 74 | + - name: Build container image |
| 75 | + id: build-and-push |
| 76 | + uses: docker/build-push-action@v5 |
| 77 | + with: |
| 78 | + push: true |
| 79 | + file: "${{ github.workspace }}/CI/Dockerfiles/${{ matrix.dockerfile }}" |
| 80 | + tags: | |
| 81 | + ${{ env.REPO }}:${{ matrix.image-tag }} |
| 82 | + ${{ env.REPO }}:${{ matrix.image-tag }}J${{ github.run_number }} |
| 83 | + outputs: "type=image,name=target,\ |
| 84 | + annotation-index.org.opencontainers.image.authors=Claudio André <[email protected]>,\ |
| 85 | + annotation-index.org.opencontainers.image.description=John the Ripper CI" |
| 86 | + |
| 87 | + - name: Output image |
| 88 | + id: image |
| 89 | + run: | |
| 90 | + image_name="${{ env.REPO }}:${{ matrix.image-tag }}" |
| 91 | + echo "The image is $image_name" |
| 92 | + echo "image=$image_name" >> "$GITHUB_OUTPUT" |
| 93 | +
|
| 94 | + # It's unclear whether provenance can work with a matrix of Docker images |
| 95 | + provenance: |
| 96 | + if: ${{ false }} |
| 97 | + needs: [build] |
| 98 | + permissions: |
| 99 | + actions: read # for detecting the GitHub Actions environment. |
| 100 | + id-token: write # for creating OIDC tokens for signing. |
| 101 | + packages: write # for uploading attestations. |
| 102 | + uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] |
| 103 | + with: |
| 104 | + image: ${{ needs.build.outputs.image }} |
| 105 | + digest: ${{ needs.build.outputs.digest }} |
| 106 | + registry-username: ${{ github.actor }} |
| 107 | + secrets: |
| 108 | + registry-password: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments