2024-01-17 11:08:16 +00:00

59 lines
1.8 KiB
YAML

name: sync images
on:
workflow_call:
inputs:
ref:
type: string
description: The Git ref to use in the checkout.
jobs:
build_manifest_matrix:
runs-on: ubuntu-latest
outputs:
manifest-files: ${{ steps.list-manifests.outputs.manifest-files }}
steps:
- name: Check out the repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: List manifests
id: list-manifests
# Use jq to format the manifest list as a JSON array
run: |
MANIFEST_FILES="$(ls ./skopeo-manifests/*.yaml | jq -c -s -R 'split("\n") | map(select(length > 0))')"
echo "manifest-files=$MANIFEST_FILES" >> $GITHUB_OUTPUT
sync_images:
runs-on: ubuntu-latest
needs: [build_manifest_matrix]
strategy:
# Restrict the maximum number of parallel syncs to avoid quay.io push limits
# Anonymous pulls are not rate-limited
max-parallel: 4
# If one sync fails, continue with the others
fail-fast: false
matrix:
manifest-file: ${{ fromJSON(needs.build_manifest_matrix.outputs.manifest-files) }}
steps:
- name: Check out the repository
uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
# Just sync all the images in all the manifests to GitHub packages
- name: Sync component images
run: |-
podman run \
-v ./skopeo-manifests:/opt/skopeo-manifests \
-w /opt \
quay.io/skopeo/stable:latest \
sync \
--src yaml \
--dest docker \
--dest-creds "${{ secrets.QUAY_IO_USER }}:${{ secrets.QUAY_IO_TOKEN }}" \
--scoped \
--all \
${{ matrix.manifest-file }} \
quay.io/azimuth