2020-10-25 03:21:46 +01:00
|
|
|
name: ci
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
2023-02-20 22:46:48 +01:00
|
|
|
- cron: '0 10 * * *'
|
2020-10-25 03:21:46 +01:00
|
|
|
push:
|
|
|
|
branches:
|
2021-03-29 13:04:53 +02:00
|
|
|
- 'master'
|
|
|
|
- 'releases/v*'
|
2020-10-25 03:21:46 +01:00
|
|
|
tags:
|
|
|
|
- 'v*.*.*'
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
env:
|
|
|
|
DOCKER_IMAGE: localhost:5000/name/app
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
multi-images:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-01 20:17:26 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-10-25 03:21:46 +01:00
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ env.DOCKER_IMAGE }}
|
|
|
|
ghcr.io/name/app
|
2021-03-29 13:04:53 +02:00
|
|
|
tags: |
|
|
|
|
type=schedule
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=tag
|
|
|
|
type=ref,event=pr
|
|
|
|
type=sha
|
2023-01-13 10:45:14 +01:00
|
|
|
-
|
|
|
|
name: Print envs
|
|
|
|
run: env|sort
|
2020-10-25 03:21:46 +01:00
|
|
|
|
2020-10-25 15:13:43 +01:00
|
|
|
tag-schedule:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
tag-schedule:
|
|
|
|
- ""
|
|
|
|
- "cron-{{date 'YYYYMMDD'}}"
|
|
|
|
- "{{date 'YYYYMMDD-HHmmss'}}"
|
|
|
|
- "schedule"
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-01 20:17:26 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-10-25 15:13:43 +01:00
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ env.DOCKER_IMAGE }}
|
|
|
|
ghcr.io/name/app
|
2021-03-29 13:04:53 +02:00
|
|
|
tags: |
|
|
|
|
type=schedule,pattern=${{ matrix.tag-schedule }}
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=tag
|
|
|
|
type=ref,event=pr
|
|
|
|
type=sha
|
2020-10-25 15:13:43 +01:00
|
|
|
|
2020-10-27 01:05:36 +01:00
|
|
|
tag-match:
|
2020-10-26 01:39:21 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2020-10-27 02:32:26 +01:00
|
|
|
include:
|
2021-04-03 18:15:27 +02:00
|
|
|
- tag-match: '\d.\d.\d'
|
2020-10-27 02:32:26 +01:00
|
|
|
tag-match-group: '0'
|
2021-04-03 18:15:27 +02:00
|
|
|
- tag-match: '\d.\d'
|
2020-10-27 02:32:26 +01:00
|
|
|
tag-match-group: '0'
|
|
|
|
- tag-match: 'v(.*)'
|
|
|
|
tag-match-group: '1'
|
2020-10-26 01:39:21 +01:00
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-01 20:17:26 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-10-26 01:39:21 +01:00
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ env.DOCKER_IMAGE }}
|
|
|
|
ghcr.io/name/app
|
2021-03-29 13:04:53 +02:00
|
|
|
tags: |
|
|
|
|
type=schedule
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=tag
|
|
|
|
type=ref,event=pr
|
|
|
|
type=match,"pattern=${{ matrix.tag-match }}",group=${{ matrix.tag-match-group }}
|
|
|
|
type=sha
|
2020-10-26 01:39:21 +01:00
|
|
|
|
2020-11-18 00:32:35 +01:00
|
|
|
tag-semver:
|
|
|
|
runs-on: ubuntu-latest
|
2020-12-01 06:29:34 +01:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2021-03-29 13:04:53 +02:00
|
|
|
flavor-latest:
|
|
|
|
- "auto"
|
|
|
|
- "true"
|
|
|
|
- "false"
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-01 20:17:26 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-03-29 13:04:53 +02:00
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ env.DOCKER_IMAGE }}
|
|
|
|
ghcr.io/name/app
|
|
|
|
tags: |
|
|
|
|
type=schedule
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=tag
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{raw}}
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}.{{patch}}
|
|
|
|
type=sha
|
|
|
|
flavor: |
|
|
|
|
latest=${{ matrix.flavor-latest }}
|
|
|
|
|
|
|
|
flavor:
|
|
|
|
runs-on: ubuntu-latest
|
2020-11-18 00:32:35 +01:00
|
|
|
steps:
|
2020-12-01 05:50:39 +01:00
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-01 20:17:26 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-12-01 05:50:39 +01:00
|
|
|
-
|
|
|
|
name: Docker meta
|
2020-11-18 00:32:35 +01:00
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ env.DOCKER_IMAGE }}
|
|
|
|
ghcr.io/name/app
|
2021-03-29 13:04:53 +02:00
|
|
|
flavor: |
|
|
|
|
prefix=foo-
|
|
|
|
suffix=-bar
|
2020-11-18 00:32:35 +01:00
|
|
|
|
2022-04-27 16:58:50 +02:00
|
|
|
images:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
name=${{ env.DOCKER_IMAGE }}
|
|
|
|
name=ghcr.io/name/app,enable=${{ github.event_name == 'pull_request' }}
|
|
|
|
name=ghcr.io/name/release,enable=${{ startsWith(github.ref, 'refs/tags/') }}
|
|
|
|
|
2021-03-29 13:04:53 +02:00
|
|
|
labels:
|
2020-12-23 22:09:38 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-01 20:17:26 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-12-23 22:09:38 +01:00
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ env.DOCKER_IMAGE }}
|
|
|
|
ghcr.io/name/app
|
2021-03-29 13:04:53 +02:00
|
|
|
labels: |
|
2020-12-23 22:09:38 +01:00
|
|
|
maintainer=CrazyMax
|
|
|
|
org.opencontainers.image.title=MyCustomTitle
|
2021-11-29 13:31:50 +01:00
|
|
|
org.opencontainers.image.description=this is a "good" example
|
2020-12-23 22:09:38 +01:00
|
|
|
org.opencontainers.image.vendor=MyCompany
|
|
|
|
|
2022-04-21 01:05:31 +02:00
|
|
|
global-exps:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ env.DOCKER_IMAGE }}
|
|
|
|
ghcr.io/name/app
|
|
|
|
tags: |
|
|
|
|
type=sha
|
|
|
|
type=raw,value=gexp-branch-{{branch}}
|
2023-07-13 14:05:16 +02:00
|
|
|
type=raw,value=gexp-date-{{commit_date 'YYYYMMDD'}}
|
2022-04-21 01:05:31 +02:00
|
|
|
type=raw,value=gexp-date-{{date 'YYYYMMDD'}}
|
|
|
|
type=raw,value=gexp-tag-{{tag}}
|
|
|
|
type=raw,value=gexp-baseref-{{base_ref}}
|
|
|
|
type=raw,value=gexp-defbranch,enable={{is_default_branch}}
|
|
|
|
|
2021-05-22 21:23:06 +02:00
|
|
|
json:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-01 20:17:26 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-05-22 21:23:06 +02:00
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ env.DOCKER_IMAGE }}
|
|
|
|
ghcr.io/name/app
|
|
|
|
labels: |
|
|
|
|
maintainer=CrazyMax
|
|
|
|
-
|
|
|
|
name: JSON output
|
|
|
|
run: |
|
|
|
|
echo "maintainer=${{ fromJSON(steps.meta.outputs.json).labels['maintainer'] }}"
|
|
|
|
echo "version=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}"
|
|
|
|
echo "revision=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.revision'] }}"
|
|
|
|
echo "created=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}"
|
|
|
|
|
2020-10-25 03:21:46 +01:00
|
|
|
docker-push:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-01 20:17:26 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-10-25 03:21:46 +01:00
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
id: docker_meta
|
|
|
|
uses: ./
|
|
|
|
with:
|
2022-04-28 09:08:21 +02:00
|
|
|
images: |
|
|
|
|
${{ env.DOCKER_IMAGE }}
|
2021-03-29 13:04:53 +02:00
|
|
|
tags: |
|
|
|
|
type=schedule
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=tag
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern=v{{version}}
|
|
|
|
type=semver,pattern=v{{major}}.{{minor}}
|
|
|
|
type=semver,pattern=v{{major}}
|
|
|
|
type=sha
|
2020-10-25 03:21:46 +01:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2022-05-05 19:42:03 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2020-10-25 03:21:46 +01:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:42:03 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2020-10-25 03:21:46 +01:00
|
|
|
with:
|
|
|
|
driver-opts: network=host
|
|
|
|
-
|
|
|
|
name: Build and push to local registry
|
2023-01-30 19:37:25 +01:00
|
|
|
uses: docker/build-push-action@v4
|
2020-10-25 03:21:46 +01:00
|
|
|
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()
|
2023-02-13 20:58:55 +01:00
|
|
|
uses: crazy-max/ghaction-dump-context@v2
|
2020-12-24 04:13:41 +01:00
|
|
|
|
|
|
|
bake:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-01 20:17:26 +01:00
|
|
|
uses: actions/checkout@v3
|
2020-12-24 04:13:41 +01:00
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
id: docker_meta
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ env.DOCKER_IMAGE }}
|
|
|
|
ghcr.io/name/app
|
2021-03-29 13:04:53 +02:00
|
|
|
tags: |
|
|
|
|
type=schedule
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=tag
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
type=sha
|
2020-12-24 04:13:41 +01:00
|
|
|
-
|
|
|
|
name: Set up QEMU
|
2022-05-05 19:42:03 +02:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2020-12-24 04:13:41 +01:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
2022-05-05 19:42:03 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2020-12-24 04:13:41 +01:00
|
|
|
-
|
|
|
|
name: Build
|
2023-04-18 21:57:31 +02:00
|
|
|
uses: docker/bake-action@v3
|
2020-12-24 04:13:41 +01:00
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
./test/docker-bake.hcl
|
|
|
|
${{ steps.docker_meta.outputs.bake-file }}
|
|
|
|
targets: |
|
|
|
|
release
|
2022-10-07 22:45:46 +02:00
|
|
|
|
|
|
|
sep-tags:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
sep:
|
|
|
|
- " "
|
|
|
|
- ","
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ env.DOCKER_IMAGE }}
|
|
|
|
ghcr.io/name/app
|
|
|
|
sep-tags: ${{ matrix.sep }}
|
|
|
|
-
|
|
|
|
name: Tags
|
|
|
|
uses: actions/github-script@v6
|
|
|
|
with:
|
|
|
|
script: |
|
|
|
|
console.log(`${{ steps.meta.outputs.tags }}`);
|
2023-01-13 10:45:14 +01:00
|
|
|
|
|
|
|
output-env:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
-
|
|
|
|
name: Docker meta
|
|
|
|
id: meta
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
images: |
|
|
|
|
${{ env.DOCKER_IMAGE }}
|
|
|
|
ghcr.io/name/app
|
|
|
|
labels: |
|
|
|
|
maintainer=CrazyMax
|
|
|
|
-
|
|
|
|
name: Build
|
2023-01-30 19:37:25 +01:00
|
|
|
uses: docker/build-push-action@v4
|
2023-01-13 10:45:14 +01:00
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/output.Dockerfile
|
|
|
|
build-args: |
|
|
|
|
DOCKER_METADATA_OUTPUT_VERSION
|
|
|
|
DOCKER_METADATA_OUTPUT_TAGS
|
|
|
|
DOCKER_METADATA_OUTPUT_LABELS
|
|
|
|
DOCKER_METADATA_OUTPUT_JSON
|