Skip to content

ci(.github/workflows/wsl-docker.yml): disable provenance for build-pu… #4

ci(.github/workflows/wsl-docker.yml): disable provenance for build-pu…

ci(.github/workflows/wsl-docker.yml): disable provenance for build-pu… #4

Workflow file for this run

name: Build Ubuntu WSL Docker image
on:
schedule:
# update once a week
- cron: "0 0 * * SUN"
workflow_dispatch:
# initial run
push:
permissions: {}
defaults:
run:
shell: bash
jobs:
build-wsl:
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
packages: write # for GitHub Package Registry
id-token: write # for attest-build-provenance
attestations: write # for attest-build-provenance
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/wsl
steps:
- name: Get Ubuntu WSL build info
id: info
run: |
serial=$(curl --fail-with-body --location https://cloud-images.ubuntu.com/wsl/noble/current/unpacked/build-info.txt \
| grep --only-matching --perl-regexp 'SERIAL=\K\d+')
echo "serial=$serial" >> "$GITHUB_OUTPUT"
# cspell:ignore rootfs
- name: Download Ubuntu WSL rootfs
run: |
curl --fail-with-body --location --output ubuntu.tar.gz \
https://cloud-images.ubuntu.com/wsl/noble/current/ubuntu-noble-wsl-amd64-ubuntu.rootfs.tar.gz
- name: Create Dockerfile
run: |
cat <<EOF > Dockerfile
FROM scratch
ADD ubuntu.tar.gz /
EOF
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0
with:
context: .
push: true
# avoid image without manifest created
# ref: https://github.com/docker/build-push-action/issues/900
provenance: false
tags: |
ghcr.io/${{ env.IMAGE_NAME }}:${{ steps.info.outputs.serial }}
ghcr.io/${{ env.IMAGE_NAME }}:latest
- name: Attest Build Provenance
uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true
actions-timeline:
needs:
- build-wsl
if: ${{ !cancelled() }}
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
actions: read # for actions-timeline
steps:
- name: actions-timeline
# cspell:ignore kesin
uses: Kesin11/actions-timeline@3046833d9aacfd7745c5264b7f3af851c3e2a619 # v2.2.1