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