2021-11-16 06:19:27 +00:00
|
|
|
# This workflow is provided just as an example and not for repo testing/verification
|
2020-09-12 18:40:12 +00:00
|
|
|
name: example
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
2021-11-16 06:19:27 +00:00
|
|
|
- cron: '0 10 * * 0'
|
2020-09-12 18:40:12 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- '**'
|
|
|
|
tags:
|
|
|
|
- 'v*.*.*'
|
|
|
|
pull_request:
|
|
|
|
|
2020-10-28 18:40:11 +00:00
|
|
|
env:
|
|
|
|
DOCKER_IMAGE: localhost:5000/name/app
|
|
|
|
|
2020-09-12 18:40:12 +00:00
|
|
|
jobs:
|
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
services:
|
|
|
|
registry:
|
|
|
|
image: registry:2
|
|
|
|
ports:
|
|
|
|
- 5000:5000
|
|
|
|
steps:
|
|
|
|
-
|
|
|
|
name: Checkout
|
2022-03-02 11:03:44 +00:00
|
|
|
uses: actions/checkout@v3
|
2020-09-12 18:40:12 +00:00
|
|
|
-
|
2020-10-28 18:40:11 +00:00
|
|
|
name: Docker meta
|
2021-03-29 12:33:52 +00:00
|
|
|
id: meta
|
2021-05-10 16:01:34 +00:00
|
|
|
uses: docker/metadata-action@v3
|
2020-10-28 18:40:11 +00:00
|
|
|
with:
|
2021-03-29 12:33:52 +00:00
|
|
|
images: ${{ env.DOCKER_IMAGE }}
|
|
|
|
tags: |
|
|
|
|
type=schedule
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
type=semver,pattern={{major}}
|
|
|
|
type=sha
|
2020-09-12 18:40:12 +00:00
|
|
|
-
|
|
|
|
name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
with:
|
|
|
|
driver-opts: network=host
|
|
|
|
-
|
|
|
|
name: Build and export to Docker client
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|
2020-10-28 18:40:11 +00:00
|
|
|
load: true
|
2021-03-29 12:33:52 +00:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2020-09-12 18:40:12 +00:00
|
|
|
-
|
|
|
|
name: Build and push to local registry
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
context: ./test
|
|
|
|
file: ./test/Dockerfile
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
2021-03-29 12:33:52 +00:00
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
2020-09-12 18:40:12 +00:00
|
|
|
-
|
|
|
|
name: Inspect image
|
|
|
|
run: |
|
2021-03-29 12:33:52 +00:00
|
|
|
docker image inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
|
2020-09-12 18:40:12 +00:00
|
|
|
-
|
|
|
|
name: Check manifest
|
|
|
|
if: github.event_name != 'pull_request'
|
|
|
|
run: |
|
2021-03-29 12:33:52 +00:00
|
|
|
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE }}:${{ steps.meta.outputs.version }}
|
2020-09-12 18:40:12 +00:00
|
|
|
-
|
|
|
|
name: Dump context
|
|
|
|
if: always()
|
|
|
|
uses: crazy-max/ghaction-dump-context@v1
|