docker-postfix/.github/actions/build-logrotate/action.yaml
2023-10-27 09:12:42 +02:00

58 lines
1.6 KiB
YAML

name: 'Build the logrotate'
description: 'Build the latest version of logrotate'
inputs:
DOCKER_ACCESS_TOKEN:
description: 'DOCKER_ACCESS_TOKEN'
required: true
tags:
description: 'Docker image tags'
required: true
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
repository: blacklabelops/logrotate
path: 'logrotate'
ref: 'fdab0abc0b3f2917052e5d509e14e2b71d7fd9b3' # Latest commit we know that works
- name: Apply patches
shell: bash
run: |
cd logrotate
git apply ../logrotate-*.patch
# Buildkit setup
- uses: ./.github/actions/buildx-setup
# Docker hub login
- uses: ./.github/actions/docker-hub-login
with:
DOCKER_ACCESS_TOKEN: '${{ inputs.DOCKER_ACCESS_TOKEN }}'
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-logrotate-${{ github.sha }}
restore-keys: |
${{ runner.os }}-logrotate-
- name: Build and push
uses: docker/build-push-action@v5
with:
context: logrotate
push: true
tags: '${{ inputs.tags }}'
platforms: "linux/arm/v6,linux/arm/v7,linux/amd64,linux/arm64,linux/ppc64le,linux/s390x"
cache-from: type=local,src=/tmp/.buildx-cache/logrotate,mode=max,compression=estargz
cache-to: type=local,dest=/tmp/.buildx-cache-new/logrotate
- name: Move cache
shell: bash
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache