nightly #68
Workflow file for this run
This file contains hidden or 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: nightly | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| component: | |
| - squashfs-tools | |
| - mkfs | |
| name: oci build ${{ matrix.component }} | |
| steps: | |
| - uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
| with: | |
| submodules: recursive | |
| - uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0 | |
| - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 | |
| - uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1 # v6.2.0 | |
| id: push-step | |
| with: | |
| file: ./Dockerfile.${{ matrix.component }} | |
| platforms: linux/amd64,linux/aarch64 | |
| tags: ghcr.io/edera-dev/${{ matrix.component }}:nightly | |
| push: true | |
| - name: Sign the image | |
| env: | |
| DIGEST: ${{ steps.push-step.outputs.digest }} | |
| TAGS: ghcr.io/edera-dev/${{ matrix.component }}:nightly | |
| COSIGN_EXPERIMENTAL: "true" | |
| run: cosign sign --yes "${TAGS}@${DIGEST}" | |
| - name: Build `build` stage for source-commit capture | |
| uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1 # v6.2.0 | |
| with: | |
| file: ./Dockerfile.${{ matrix.component }} | |
| target: build | |
| platforms: linux/amd64 | |
| load: true | |
| tags: sbom-scan-${{ matrix.component }}:latest | |
| - name: Generate and attest CycloneDX SBOM | |
| env: | |
| DIGEST: ${{ steps.push-step.outputs.digest }} | |
| TAGS: ghcr.io/edera-dev/${{ matrix.component }}:nightly | |
| COMPONENT: ${{ matrix.component }} | |
| COSIGN_EXPERIMENTAL: "true" | |
| run: | | |
| set -euo pipefail | |
| scan="sbom-scan-${COMPONENT}:latest" | |
| sha() { docker run --rm "${scan}" git -C "$1" rev-parse HEAD; } | |
| desc() { docker run --rm "${scan}" git -C "$1" describe --tags --always; } | |
| case "${COMPONENT}" in | |
| squashfs-tools) | |
| SQUASHFS_TOOLS_COMMIT="$(sha /usr/src/squashfs-tools)" | |
| SQUASHFS_TOOLS_VERSION="$(desc /usr/src/squashfs-tools)" | |
| ZLIB_NG_COMMIT="$(sha /usr/src/zlib-ng)" | |
| ZLIB_NG_VERSION="$(desc /usr/src/zlib-ng)" | |
| export SQUASHFS_TOOLS_COMMIT SQUASHFS_TOOLS_VERSION \ | |
| ZLIB_NG_COMMIT ZLIB_NG_VERSION | |
| ;; | |
| mkfs) | |
| E2FSPROGS_COMMIT="$(sha /usr/src/e2fsprogs)" | |
| E2FSPROGS_VERSION="$(desc /usr/src/e2fsprogs)" | |
| export E2FSPROGS_COMMIT E2FSPROGS_VERSION | |
| ;; | |
| esac | |
| python3 generate-sbom.py | |
| jq -e '.bomFormat == "CycloneDX" and ((.components // []) | length > 0)' \ | |
| "${COMPONENT}.cdx.json" >/dev/null \ | |
| || { echo "::error::SBOM for ${COMPONENT} is empty or invalid"; exit 1; } | |
| jq '{component: env.COMPONENT, components: (.components | length)}' \ | |
| "${COMPONENT}.cdx.json" | |
| cosign attest --yes --type cyclonedx \ | |
| --predicate "${COMPONENT}.cdx.json" \ | |
| "${TAGS}@${DIGEST}" |