104 lines
3.6 KiB
YAML
104 lines
3.6 KiB
YAML
name: Build containers
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
paths: ["containers/**", ".gitea/workflows/fedora.yaml"]
|
|
pull_request:
|
|
branches: ["main"]
|
|
paths: ["containers/**", ".gitea/workflows/fedora.yaml"]
|
|
schedule:
|
|
- cron: "0 16 * * FRI"
|
|
|
|
jobs:
|
|
changes:
|
|
runs-on: job-v2
|
|
env:
|
|
RUNNER_OS2: "Linux"
|
|
outputs:
|
|
fedora: ${{ steps.filter.outputs.fedora == 'true' }}
|
|
infra: ${{ steps.filter.outputs.infra == 'true' || steps.filter.outputs.fedora == 'true' }}
|
|
go: ${{ steps.filter.outputs.go == 'true' || steps.filter.outputs.fedora == 'true' }}
|
|
any_change: ${{ steps.filter.outputs.workflow == 'true' || github.event_name == 'schedule' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: https://github.com/dorny/paths-filter@v3
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
workflow: ['.gitea/workflows/fedora.yaml']
|
|
fedora: ['containers/fedora/**']
|
|
infra: ['containers/infra/**']
|
|
go: ['containers/go/**']
|
|
- name: debug
|
|
run: |
|
|
echo "$RUNNER_OS2"
|
|
|
|
fedora-base:
|
|
needs: [changes]
|
|
if: ${{ needs.changes.outputs.fedora == 'true' || needs.changes.outputs.any_change == 'true' }}
|
|
runs-on: job-v2
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Log in
|
|
uses: redhat-actions/podman-login@v1
|
|
with:
|
|
registry: git.plabble.org
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
- name: Build Fedora
|
|
id: build
|
|
uses: redhat-actions/buildah-build@v2
|
|
with:
|
|
image: ${{ github.actor }}/fedora
|
|
tags: ${{ github.ref_name }}
|
|
containerfiles: ./containers/fedora/Containerfile
|
|
oci: true
|
|
- name: Push Fedora
|
|
uses: redhat-actions/push-to-registry@v2
|
|
with:
|
|
image: ${{ steps.build.outputs.image }}
|
|
tags: ${{ steps.build.outputs.tags }}
|
|
registry: git.plabble.org
|
|
extra-args: --compression-format=zstd:chunked
|
|
|
|
dependent-images:
|
|
needs: [changes, fedora-base]
|
|
runs-on: job-v2
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
container: [infra, go]
|
|
steps:
|
|
- name: Check if build needed
|
|
id: check
|
|
run: |
|
|
if [[ "${{ matrix.container }}" == "infra" && "${{ needs.changes.outputs.infra }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
|
|
if [[ "${{ matrix.container }}" == "go" && "${{ needs.changes.outputs.go }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi
|
|
- name: Clone repo
|
|
if: steps.check.outputs.run == 'true'
|
|
uses: actions/checkout@v4
|
|
- name: Log in
|
|
if: steps.check.outputs.run == 'true'
|
|
uses: redhat-actions/podman-login@v1
|
|
with:
|
|
registry: git.plabble.org
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
- name: Build ${{ matrix.container }}
|
|
if: steps.check.outputs.run == 'true'
|
|
id: build
|
|
uses: redhat-actions/buildah-build@v2
|
|
with:
|
|
image: ${{ github.actor }}/${{ matrix.container }}
|
|
tags: ${{ github.ref_name }}
|
|
containerfiles: ./containers/${{ matrix.container }}/Containerfile
|
|
oci: true
|
|
- name: Push ${{ matrix.container }}
|
|
if: steps.check.outputs.run == 'true'
|
|
uses: redhat-actions/push-to-registry@v2
|
|
with:
|
|
image: ${{ steps.build.outputs.image }}
|
|
tags: ${{ steps.build.outputs.tags }}
|
|
registry: git.plabble.org
|
|
extra-args: --compression-format=zstd:chunked
|