Skip to content

Commit

Permalink
chore(ci): add GitHub Action for Docker build
Browse files Browse the repository at this point in the history
Based on our own reusable GitHub workflows for Docker from:

- tiacsys/github-workflows/.github/workflows/docker-stages.yml@main
- tiacsys/github-workflows/.github/workflows/docker-retention.yml@main

Use our own reusable GitHub workflows for Retry on Failure from:

- tiacsys/github-workflows/.github/workflows/retry-workflow.yml@main

Signed-off-by: Stephan Linz <[email protected]>
  • Loading branch information
rexut committed Oct 20, 2024
1 parent cd16495 commit 2607dfe
Show file tree
Hide file tree
Showing 7 changed files with 125 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/platforms.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"include": [
{ "platform": "linux/amd64" },
{ "platform": "linux/arm/v7" },
{ "platform": "linux/arm64/v8" },
{ "platform": "linux/riscv64" },
{ "platform": "linux/ppc64le" },
{ "platform": "linux/s390x" }
]
}
6 changes: 6 additions & 0 deletions .github/stages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"include": [
{ "stage": "base" },
{ "stage": "push", "ghr-free-disk": false }
]
}
14 changes: 14 additions & 0 deletions .github/workflows/clean-buildcache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Clean Buildcache

on:
workflow_dispatch: # Manually on button click

jobs:
setup:
name: Setup

# Delete the "buildcache-*" tagged Docker images on demand.
uses: tiacsys/github-workflows/.github/workflows/docker-mr-proper.yml@main
with:
delete-tags: buildcache-*
secrets: inherit # pass all secrets
47 changes: 47 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Docker

on:
schedule:
# every day at 01:00 UTC
# https://crontab.guru/#0_1_*_*_*
- cron: '0 1 * * *'
push:
branches:
- 'main'
# Publish calver or pep440 tags as releases.
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+rc[0-9]+'
paths:
- '.github/workflows/docker-publish.yml'
- '.github/workflows/retry-workflow.yml'
- '.github/platforms.json'
- '.github/stages.json'
- '.dockerignore'
- 'Dockerfile'
pull_request:
branches:
- 'main'
paths:
- '.github/workflows/docker-publish.yml'
- '.github/workflows/retry-workflow.yml'
- '.github/platforms.json'
- '.github/stages.json'
- '.dockerignore'
- 'Dockerfile'

jobs:
setup:
name: Setup

# Build all multi-platform Docker images, all stages. The specified
# stages (in ./.github/stages.json) are built one after the other
# for the specified platforms (in ./.github/platforms.json) and,
# if successful, are finally merged via a Docker manifest and
# published to the Docker registry on GitHub.
uses: tiacsys/github-workflows/.github/workflows/docker-stages.yml@main
with:
ghr-free-disk: false
platforms-json: ./.github/platforms.json
stages-json: ./.github/stages.json
secrets: inherit # pass all secrets
15 changes: 15 additions & 0 deletions .github/workflows/pr-close-policy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: PR Close Policy

on:
pull_request:
types: [closed]

jobs:
setup:
name: Setup

# Delete the "pr-#" tagged Docker images when a pull request is closed.
uses: tiacsys/github-workflows/.github/workflows/docker-mr-proper.yml@main
with:
delete-tags: pr-${{github.event.pull_request.number}}
secrets: inherit # pass all secrets
18 changes: 18 additions & 0 deletions .github/workflows/retention-policy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Retention Policy

on:
workflow_dispatch: # And manually on button click
schedule:
# every day at 00:05 UTC
- cron: '5 0 * * *'

jobs:
setup:
name: Setup

# Delete all untagged Docker images older than 2 weeks.
uses: tiacsys/github-workflows/.github/workflows/docker-retention.yml@main
with:
older-than: 2 weeks
exclude-tags: "^\\d+\\.\\d+\\.\\d+$|^latest$|^main$|^nightly$"
secrets: inherit # pass all secrets
15 changes: 15 additions & 0 deletions .github/workflows/retry-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Retry Workflow

on:
workflow_dispatch:
inputs:
runid:
required: true

jobs:
fail:
name: Fail

uses: tiacsys/github-workflows/.github/workflows/retry-workflow.yml@main
with:
runid: ${{ inputs.runid }}

0 comments on commit 2607dfe

Please sign in to comment.