Skip to content

Github Actions(deps): Bump docker/metadata-action from 4 to 5 #17

Github Actions(deps): Bump docker/metadata-action from 4 to 5

Github Actions(deps): Bump docker/metadata-action from 4 to 5 #17

Workflow file for this run

name: Container Build
on:
push:
tags:
- v*
pull_request:
branches:
- 'main'
env:
IMAGE_NAME: 'aessing/chronyd'
permissions:
packages: write
jobs:
build:
name: Build container
runs-on: ubuntu-latest
steps:
- name: Set release date
run: |
echo "RELEASE_DATE=$(date -u '+%Y-%m-%dT%H:%M:%S%z')" >> ${GITHUB_ENV}
- name: Checkout code
uses: actions/checkout@v4
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
# https://github.com/docker/login-action
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# https://github.com/docker/metadata-action
- name: Set container meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.IMAGE_NAME }}
ghcr.io/${{ env.IMAGE_NAME }}
tags: |
type=schedule,pattern={{date 'YYYYMMDD-HHmmss' tz='UTC'}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
# https://github.com/docker/build-push-action
- name: Build and push
id: build
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/386, linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64/v8, linux/ppc64le, linux/s390x
build-args: BUILD_DATE=${{ env.RELEASE_DATE }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}