62 lines
1.8 KiB
YAML
62 lines
1.8 KiB
YAML
name: image puller runner
|
|
run-name: Pull and Push 🚀
|
|
on:
|
|
push:
|
|
workflow_dispatch: # Enables the manual run UI button
|
|
|
|
jobs:
|
|
setup:
|
|
env:
|
|
RUNNER_TOOL_CACHE: /toolcache
|
|
|
|
container:
|
|
image: gitea.geeraert.eu/pi-ux-ce/custom-runner-debian-slim:latest
|
|
volumes:
|
|
- act-toolcache:/opt/hostedtoolcache # this is where Runner store their cache default
|
|
runs-on: host-runner
|
|
outputs:
|
|
image_matrix: ${{ steps.set-matrix.outputs.images }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Parse image file into JSON array
|
|
id: set-matrix
|
|
run: |
|
|
# Read lines, remove empty lines/comments, and format as a JSON array
|
|
# e.g., ["ubuntu:latest", "alpine:3.18"]
|
|
JSON_ARRAY=$(jq -R -s -c 'split("\n") | map(select(length > 0 and (startswith("#") | not)))' image_list.txt)
|
|
|
|
echo "Images found: $JSON_ARRAY"
|
|
echo "images=$JSON_ARRAY" >> $GITHUB_OUTPUT
|
|
|
|
# Job 2: Process each image in parallel matrix slots
|
|
process-images:
|
|
needs: setup
|
|
runs-on: host-runner
|
|
container:
|
|
image: gitea.geeraert.eu/pi-ux-ce/custom-runner-debian-slim:latest
|
|
strategy:
|
|
# Prevents all other jobs from failing immediately if one image fails
|
|
fail-fast: false
|
|
matrix:
|
|
image: ${{ fromJSON(needs.setup.outputs.image_matrix) }}
|
|
|
|
steps:
|
|
- name: Login to gitea
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: gitea.geeraert.eu
|
|
username: ${{ secrets.USERNAME_GITEA }}
|
|
password: ${{ secrets.PASSWORD_GITEA }}
|
|
|
|
|
|
- run: docker pull ${{ matrix.image }}
|
|
|
|
- run: docker tag ${{ matrix.image }} gitea.geeraert.eu/pi-ux-ce/${{ matrix.image }}
|
|
|
|
|
|
- name: Push image
|
|
run: docker push gitea.geeraert.eu/pi-ux-ce/${{ matrix.image }}
|
|
|