workflow Massive Changes

This commit is contained in:
Xaver Russ 2025-07-13 23:49:10 +02:00
parent 364ec21955
commit f070d5d3cd
3 changed files with 69 additions and 39 deletions

View file

@ -0,0 +1,69 @@
run-name: Build and Push Ansible Container
on:
push:
branches:
- main
paths:
- 'containers/${{ github.workflow }}/**'
workflow_dispatch: {}
schedule:
- cron: '0 20 * * 5'
jobs:
build-and-push:
strategy:
matrix:
arch: [ amd64, arm64 ]
runs-on:
- ${{ matrix.arch }}
- docker
container:
image: docker:24-dind
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Builder
uses: docker/setup-buildx-action@v3
- name: Login to Forgejo Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.CI_REGISTRY }}
username: ${{ secrets.CI_REGISTRY_USER }}
password: ${{ secrets.CI_TOKEN }}
- name: Set working directory
run: |
cd containers/${{ github.workflow }}/
shell: bash
- name: Build and push (${{ matrix.arch }})
uses: docker/build-push-action@v5
with:
context: containers/${{ github.workflow }}/
file: containers/${{ github.workflow }}/Dockerfile
platforms: linux/${{ matrix.arch }}
push: true
tags: |
${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:${{ matrix.arch }}-latest
manifest:
needs: build-and-push
runs-on: amd64-docker
container:
image: docker:24-dind
steps:
- name: Login to Forgejo Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.CI_REGISTRY }}
username: ${{ secrets.CI_REGISTRY_USER }}
password: ${{ secrets.CI_TOKEN }}
- name: Create and push multi-arch manifest
run: |
docker manifest create ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:latest \
${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:amd64-latest \
${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:arm64-latest
docker manifest push ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:latest

View file

@ -1,39 +0,0 @@
name: Build and Push Docker Image
run-name: Build and Push Docker Image
on:
push:
branches:
- main
workflow_dispatch: {}
schedule:
- cron: '0 20 * * 5'
jobs:
build-and-push:
# The runner with this label must have Docker installed to be able to run service containers.
runs-on: node
container:
image: docker:24-dind
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Builder
# This action will automatically use the 'dind' service as the build server.
uses: docker/setup-buildx-action@v3
- name: Login to Forgejo Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.CI_REGISTRY }}
username: ${{ secrets.CI_REGISTRY_USER }}
password: ${{ secrets.CI_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ secrets.CI_REGISTRY }}/${{ secrets.CI_REPOSITORY }}:latest