mirror of
https://github.com/ansible-collections/community.docker.git
synced 2026-03-15 19:58:28 +00:00
88 lines
2.8 KiB
YAML
88 lines
2.8 KiB
YAML
---
|
|
# Copyright (c) Ansible Project
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
name: Helper Docker images for testing
|
|
'on':
|
|
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- .github/workflows/docker-images.yml
|
|
- tests/images/**
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- .github/workflows/docker-images.yml
|
|
- tests/images/**
|
|
# Run CI once per day (at 03:00 UTC)
|
|
schedule:
|
|
- cron: '0 3 * * *'
|
|
|
|
env:
|
|
CONTAINER_REGISTRY: ghcr.io/ansible-collections
|
|
|
|
jobs:
|
|
build:
|
|
name: Build image ${{ matrix.name }}:${{ matrix.tag }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: simple-1
|
|
tag: tag
|
|
tag-as-latest: true
|
|
- name: simple-2
|
|
tag: tag
|
|
tag-as-latest: true
|
|
- name: healthcheck
|
|
tag: check
|
|
tag-as-latest: true
|
|
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get install podman buildah
|
|
|
|
- name: Set up Go 1.26
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: '1.26'
|
|
cache: false # true (default) results in warnings since we don't use Go modules
|
|
|
|
- name: Build ${{ matrix.name }} image
|
|
run: |
|
|
./build.sh "${CONTAINER_REGISTRY}/${{ matrix.name }}:${{ matrix.tag }}"
|
|
working-directory: tests/images/${{ matrix.name }}
|
|
|
|
- name: Tag image as latest
|
|
if: matrix.tag-as-latest && matrix.tag != 'latest'
|
|
env:
|
|
SOURCE_IMAGE: ${{ matrix.name }}:${{ matrix.tag }}
|
|
DEST_IMAGE: ${{ matrix.name }}:latest
|
|
run: >-
|
|
podman tag "${CONTAINER_REGISTRY}/${SOURCE_IMAGE}" "${CONTAINER_REGISTRY}/${DEST_IMAGE}"
|
|
|
|
- name: Publish container image ${{ env.CONTAINER_REGISTRY }}/${{ matrix.name }}:${{ matrix.tag }}
|
|
if: github.event_name != 'pull_request'
|
|
env:
|
|
IMAGE: ${{ matrix.name }}:${{ matrix.tag }}
|
|
run: >-
|
|
podman push "${IMAGE}" "${CONTAINER_REGISTRY}/${IMAGE}" --tls-verify=true --creds=${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Publish container image ${{ env.CONTAINER_REGISTRY }}/${{ matrix.name }}:latest
|
|
if: github.event_name != 'pull_request' && matrix.tag-as-latest && matrix.tag != 'latest'
|
|
env:
|
|
IMAGE: ${{ matrix.name }}:latest
|
|
run: >-
|
|
podman push "${IMAGE}" "${CONTAINER_REGISTRY}/${IMAGE}" --tls-verify=true --creds=${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}
|