Say it with me now, all hail the matrix.

This commit is contained in:
Greyscale 2024-05-19 04:05:47 +02:00
parent 3675824d44
commit 048637f624
No known key found for this signature in database
GPG key ID: 74BAFF55434DA4B2
2 changed files with 39 additions and 22 deletions

28
.github/workflows/ghcr-cleanup.yml vendored Normal file
View file

@ -0,0 +1,28 @@
name: "Cleanup"
permissions:
contents: read
packages: write
on:
workflow_dispatch:
workflow_run:
workflows: ["Build Swarm Connectivity Tester"]
types:
- completed
jobs:
cleanup:
name: Delete untagged images
runs-on: ubuntu-latest
steps:
- run: docker login ghcr.io -u ${{ github.repository_owner }} -p ${{ secrets.GITHUB_TOKEN }}
- uses: vlaurin/action-ghcr-prune@v0.6.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
organization: ${{ github.repository_owner }}
container: swarm-connectivity-tester
dry-run: true
keep-younger-than: 7 # days
keep-last: 2
prune-untagged: true

View file

@ -24,6 +24,11 @@ jobs:
swarm-connectivity-tester-build:
name: Build Swarm Connectivity Tester
runs-on: ubuntu-latest
strategy:
matrix:
component:
- target
- reporter
steps:
- uses: benzine-framework/action-setup-php@main
- uses: benzine-framework/action-get-datetime@main
@ -31,37 +36,21 @@ jobs:
with:
ghcr_user: matthewbaggett
ghcr_token: ${{ secrets.GITHUB_TOKEN }}
- name: "Build: Build & Push Target Image"
uses: docker/build-push-action@v5
docker_hub_user: matthewbaggett
docker_hub_token: ${{ secrets.DOCKER_HUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
context: .
target: connect-target
target: connect-${{ matrix.component }}
platforms: ${{ github.actor != 'nektos/act' && env.PLATFORMS || 'linux/amd64' }}
pull: true
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
benzine/swarm-connectivity-tester:target
ghcr.io/benzine-framework/swarm-connectivity-tester:target
benzine/swarm-connectivity-tester:${{ matrix.component }}
ghcr.io/benzine-framework/swarm-connectivity-tester:${{ matrix.component }}
cache-from: ${{ env.DOCKER_CACHE_FROM }}
cache-to: ${{ env.DOCKER_CACHE_TO }}
build-contexts: |
php:cli=docker-image://ghcr.io/benzine-framework/php:cli-8.2
php:nginx=docker-image://ghcr.io/benzine-framework/php:nginx-8.2
- name: "Build: Build & Push Report Image"
uses: docker/build-push-action@v5
with:
context: .
target: connect-reporter
platforms: ${{ github.actor != 'nektos/act' && env.PLATFORMS || 'linux/amd64' }}
pull: true
push: ${{ github.ref == 'refs/heads/main' }}
tags: |
benzine/swarm-connectivity-tester:reporter
ghcr.io/benzine-framework/swarm-connectivity-tester:reporter
cache-from: ${{ env.DOCKER_CACHE_FROM }}
cache-to: ${{ env.DOCKER_CACHE_TO }}
build-contexts: |
php:cli=docker-image://ghcr.io/benzine-framework/php:cli-8.2
php:nginx=docker-image://ghcr.io/benzine-framework/php:nginx-8.2