Copy-paste remnant #74
This file contains 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: Build and publish Spare Cores images | |
on: | |
push: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
find-jobs: | |
runs-on: ubuntu-latest | |
name: Find Jobs | |
outputs: | |
folders: ${{ steps.jobs.outputs.folders }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: jobs | |
uses: kmanimaran/list-folder-action@v4 | |
with: | |
path: ./images | |
matrix: | |
# runs-on: ubuntu-latest | |
runs-on: self-hosted | |
name: Matrix Jobs | |
needs: [find-jobs] | |
defaults: | |
run: | |
working-directory: ${{ github.workspace }}/images/${{ matrix.folder }} | |
strategy: | |
matrix: | |
folder: ${{ fromJson(needs.find-jobs.outputs.folders )}} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/sparecores/${{ matrix.folder }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ${{ github.workspace }}/images/${{ matrix.folder }} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=registry,ref=${{ env.REGISTRY }}/sparecores/${{ matrix.folder }}:buildcache | |
cache-to: type=registry,ref=${{ env.REGISTRY }}/sparecores/${{ matrix.folder }}:buildcache,mode=max |