mirror of
https://github.com/docker/metadata-action.git
synced 2024-11-13 23:55:42 +01:00
215 lines
5.0 KiB
YAML
215 lines
5.0 KiB
YAML
name: ci
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 */4 * * *' # every 4 hours
|
|
push:
|
|
branches:
|
|
- '**'
|
|
tags:
|
|
- 'v*.*.*'
|
|
pull_request:
|
|
|
|
env:
|
|
DOCKER_IMAGE: localhost:5000/name/app
|
|
|
|
jobs:
|
|
multi-images:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
-
|
|
name: Docker meta
|
|
uses: ./
|
|
with:
|
|
images: |
|
|
${{ env.DOCKER_IMAGE }}
|
|
ghcr.io/name/app
|
|
tag-sha: true
|
|
|
|
tag-schedule:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
tag-schedule:
|
|
- ""
|
|
- "cron-{{date 'YYYYMMDD'}}"
|
|
- "{{date 'YYYYMMDD-HHmmss'}}"
|
|
- "schedule"
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
-
|
|
name: Docker meta
|
|
uses: ./
|
|
with:
|
|
images: |
|
|
${{ env.DOCKER_IMAGE }}
|
|
ghcr.io/name/app
|
|
tag-sha: true
|
|
tag-schedule: ${{ matrix.tag-schedule }}
|
|
|
|
tag-match:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- tag-match: '\d{1,3}.\d{1,3}.\d{1,3}'
|
|
tag-match-group: '0'
|
|
- tag-match: '\d{1,3}.\d{1,3}'
|
|
tag-match-group: '0'
|
|
- tag-match: 'v(.*)'
|
|
tag-match-group: '1'
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
-
|
|
name: Docker meta
|
|
uses: ./
|
|
with:
|
|
images: |
|
|
${{ env.DOCKER_IMAGE }}
|
|
ghcr.io/name/app
|
|
tag-sha: true
|
|
tag-match: ${{ matrix.tag-match }}
|
|
tag-match-group: ${{ matrix.tag-match-group }}
|
|
|
|
tag-semver:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
tag-latest:
|
|
- 'true'
|
|
- 'false'
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
-
|
|
name: Docker meta
|
|
uses: ./
|
|
with:
|
|
images: |
|
|
${{ env.DOCKER_IMAGE }}
|
|
ghcr.io/name/app
|
|
tag-semver: |
|
|
{{raw}}
|
|
{{version}}
|
|
{{major}}.{{minor}}.{{patch}}
|
|
tag-latest: ${{ matrix.tag-latest }}
|
|
|
|
label-custom:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
-
|
|
name: Docker meta
|
|
uses: ./
|
|
with:
|
|
images: |
|
|
${{ env.DOCKER_IMAGE }}
|
|
ghcr.io/name/app
|
|
label-custom: |
|
|
maintainer=CrazyMax
|
|
org.opencontainers.image.title=MyCustomTitle
|
|
org.opencontainers.image.description=Another description
|
|
org.opencontainers.image.vendor=MyCompany
|
|
|
|
docker-push:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
registry:
|
|
image: registry:2
|
|
ports:
|
|
- 5000:5000
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
-
|
|
name: Docker meta
|
|
id: docker_meta
|
|
uses: ./
|
|
with:
|
|
images: ${{ env.DOCKER_IMAGE }}
|
|
tag-sha: true
|
|
tag-semver: |
|
|
v{{version}}
|
|
v{{major}}.{{minor}}
|
|
v{{major}}
|
|
-
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
with:
|
|
driver-opts: network=host
|
|
-
|
|
name: Build and push to local registry
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: ./test
|
|
file: ./test/Dockerfile
|
|
platforms: linux/amd64,linux/arm64,linux/386
|
|
push: true
|
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
|
-
|
|
name: Inspect image
|
|
run: |
|
|
docker pull ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
|
|
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
|
|
-
|
|
name: Check manifest
|
|
run: |
|
|
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.docker_meta.outputs.version }}
|
|
-
|
|
name: Dump context
|
|
if: always()
|
|
uses: crazy-max/ghaction-dump-context@v1
|
|
|
|
bake:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
-
|
|
name: Checkout
|
|
uses: actions/checkout@v2
|
|
-
|
|
name: Docker meta
|
|
id: docker_meta
|
|
uses: ./
|
|
with:
|
|
images: |
|
|
${{ env.DOCKER_IMAGE }}
|
|
ghcr.io/name/app
|
|
tag-sha: true
|
|
tag-semver: |
|
|
{{version}}
|
|
{{major}}.{{minor}}
|
|
{{major}}
|
|
-
|
|
name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v1
|
|
-
|
|
name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
-
|
|
name: Build
|
|
uses: docker/bake-action@v1
|
|
with:
|
|
files: |
|
|
./test/docker-bake.hcl
|
|
${{ steps.docker_meta.outputs.bake-file }}
|
|
targets: |
|
|
release
|