Skip to content

Initial commit

Initial commit #1

Workflow file for this run

name: Create and publish Docker images
on:
push:
branches: ['main']
env:
REGISTRY: ghcr.io
IMAGE_NAMES: debian ubuntu
jobs:
build-and-push-images:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker images
run: |
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
for IMAGE_NAME in ${{ env.IMAGE_NAMES }}; do
echo "Building and pushing $IMAGE_NAME"
docker build -t ${{ env.REGISTRY }}/${REPO_NAME}:$IMAGE_NAME images/$IMAGE_NAME
docker push ${{ env.REGISTRY }}/${REPO_NAME}:$IMAGE_NAME
done
- name: Generate artifact attestations for Docker images
run: |
REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
for IMAGE_NAME in ${{ env.IMAGE_NAMES }}; do
echo "Generating attestation for $IMAGE_NAME"
IMAGE_DIGEST=$(docker inspect --format='{{index .RepoDigests 0}}' ${{ env.REGISTRY }}/${REPO_NAME}:$IMAGE_NAME)
echo "Digest: $IMAGE_DIGEST"
gh actions upload-artifact $IMAGE_NAME-attestation --path $IMAGE_DIGEST
done