Change tags in DOCKERHUB.md and README.md #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- develop | |
- main | |
paths: | |
- 'latest/**' | |
- 'official/**' | |
- .github/workflows/build.yml | |
- versions.json | |
workflow_dispatch: | |
env: | |
DOCKERHUB_REPOSITORY: ${{ github.repository_owner }}/klei-tools | |
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }} | |
SLACK_SIGNING_SECRET: ${{ secrets.SLACK_SIGNING_SECRET }} | |
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }} | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
latest: ${{ steps.set-matrix.outputs.latest }} | |
official: ${{ steps.set-matrix.outputs.official }} | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Set matrix | |
id: set-matrix | |
run: | | |
json="$(cat ./versions.json)" | |
{ | |
echo "latest=$(jq -cM .latest <<< "$json")" | |
echo "official=$(jq -cM .official <<< "$json")" | |
} >> "$GITHUB_OUTPUT" | |
official: | |
needs: prepare | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 1 | |
matrix: | |
image: ${{ fromJSON(needs.prepare.outputs.official) }} | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Set general outputs | |
id: general | |
run: | | |
dockerfiles_version='${{ hashFiles('official/**/Dockerfile') }}' | |
dockerfiles_version_short="$(echo "$dockerfiles_version" | cut -c 1-7)" | |
klei_tools='${{ matrix.image.version }}' | |
if [[ "$klei_tools" =~ ^[0-9a-f]{40}$ ]]; then | |
klei_tools="$(echo "$klei_tools" | cut -c 1-7)" | |
fi | |
echo "Dockerfiles version: $dockerfiles_version" | |
echo "Dockerfiles version (short): $dockerfiles_version_short" | |
echo "klei-tools version: $klei_tools" | |
{ | |
echo "dockerfiles-version=$dockerfiles_version" | |
echo "dockerfiles-version-short=$dockerfiles_version_short" | |
echo "klei-tools-version=$klei_tools" | |
} >> "$GITHUB_OUTPUT" | |
- name: Send Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' }} | |
id: slack | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
klei-tools version: ${{ steps.general.outputs.klei-tools-version }} | |
ktools version: ${{ matrix.image.ktools_version }} | |
status: in-progress | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Prepare Docker meta for a Debian image | |
uses: docker/metadata-action@v5 | |
id: debian-meta | |
with: | |
flavor: | | |
latest=${{ matrix.image.latest || 'false' }} | |
prefix=official-,onlatest=true | |
images: | | |
${{ env.DOCKERHUB_REPOSITORY }} | |
ghcr.io/${{ env.DOCKERHUB_REPOSITORY }} | |
labels: [email protected] | |
tags: | | |
type=raw,value=ktools-${{ matrix.image.ktools_version }}-debian | |
type=raw,value=ktools-${{ matrix.image.ktools_version }} | |
${{ matrix.image.latest && 'type=raw,value=debian' || '' }} | |
${{ matrix.image.latest && 'type=raw,prefix=,value=official' || '' }} | |
- name: Cache Docker layers (Debian) | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-debian-cache | |
key: ${{ format('official-ktools-{0}-debian-{1}', matrix.image.ktools_version, steps.general.outputs.dockerfiles-version-short) }} | |
restore-keys: | | |
official-ktools-${{ matrix.image.ktools_version }}-debian-${{ steps.general.outputs.dockerfiles-version-short }} | |
official-ktools-${{ matrix.image.ktools_version }}-debian- | |
- name: Build a Debian image | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
IMAGEMAGICK_VERSION=${{ matrix.image.imagemagick_version }} | |
KLEI_TOOLS_VERSION=${{ matrix.image.version }} | |
KTOOLS_VERSION=${{ matrix.image.ktools_version }} | |
cache-from: type=local,src=/tmp/.buildx-debian-cache | |
cache-to: type=local,dest=/tmp/.buildx-debian-cache-new,mode=max | |
context: . | |
file: ./official/debian/Dockerfile | |
labels: ${{ steps.debian-meta.outputs.labels }} | |
platforms: linux/amd64,linux/386 | |
pull: true | |
push: ${{ !env.ACT && github.ref == 'refs/heads/main' }} | |
tags: ${{ steps.debian-meta.outputs.tags }} | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-debian-cache | |
mv /tmp/.buildx-debian-cache-new /tmp/.buildx-debian-cache | |
- name: Update Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' && always() }} | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
klei-tools version: ${{ steps.general.outputs.klei-tools-version }} | |
ktools version: ${{ matrix.image.ktools_version }} | |
status: ${{ job.status }} | |
timestamp: ${{ steps.slack.outputs.slack-timestamp }} | |
latest: | |
needs: [prepare, official] | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 1 | |
matrix: | |
image: ${{ fromJSON(needs.prepare.outputs.latest) }} | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Set general outputs | |
id: general | |
run: | | |
dockerfiles_version='${{ hashFiles('latest/**/Dockerfile') }}' | |
dockerfiles_version_short="$(echo "$dockerfiles_version" | cut -c 1-7)" | |
klei_tools='${{ matrix.image.version }}' | |
if [[ "$klei_tools" =~ ^[0-9a-f]{40}$ ]]; then | |
klei_tools="$(echo "$klei_tools" | cut -c 1-7)" | |
fi | |
echo "Dockerfiles version: $dockerfiles_version" | |
echo "Dockerfiles version (short): $dockerfiles_version_short" | |
echo "klei-tools version: $klei_tools" | |
{ | |
echo "dockerfiles-version=$dockerfiles_version" | |
echo "dockerfiles-version-short=$dockerfiles_version_short" | |
echo "klei-tools-version=$klei_tools" | |
} >> "$GITHUB_OUTPUT" | |
- name: Send Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' }} | |
id: slack | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
klei-tools version: ${{ steps.general.outputs.klei-tools-version }} | |
ktools version: ${{ matrix.image.ktools_version }} | |
status: in-progress | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GHCR | |
uses: docker/login-action@v3 | |
if: ${{ github.event_name != 'pull_request' }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Prepare Docker meta for a Debian image | |
uses: docker/metadata-action@v5 | |
id: debian-meta | |
with: | |
flavor: latest=${{ matrix.image.latest || 'false' }} | |
images: | | |
${{ env.DOCKERHUB_REPOSITORY }} | |
ghcr.io/${{ env.DOCKERHUB_REPOSITORY }} | |
labels: [email protected] | |
tags: | | |
type=raw,value=${{ matrix.image.version }}-ktools-${{ matrix.image.ktools_version }}-debian | |
type=raw,value=${{ matrix.image.version }}-ktools-${{ matrix.image.ktools_version }} | |
type=raw,value=${{ matrix.image.version }} | |
${{ matrix.image.latest && 'type=raw,value=debian' || '' }} | |
- name: Cache Docker layers (Debian) | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-debian-cache | |
key: ${{ format('{0}-ktools-{1}-debian-{2}', matrix.image.version, matrix.image.ktools_version, steps.general.outputs.dockerfiles-version-short) }} | |
restore-keys: | | |
${{ matrix.image.version }}-ktools-${{ matrix.image.ktools_version }}-debian-${{ steps.general.outputs.dockerfiles-version-short }} | |
${{ matrix.image.version }}-ktools-${{ matrix.image.ktools_version }}-debian- | |
- name: Build a Debian image | |
uses: docker/build-push-action@v5 | |
with: | |
build-args: | | |
IMAGEMAGICK_VERSION=${{ matrix.image.imagemagick_version }} | |
KLEI_TOOLS_VERSION=${{ matrix.image.version }} | |
KTOOLS_VERSION=${{ matrix.image.ktools_version }} | |
cache-from: type=local,src=/tmp/.buildx-debian-cache | |
cache-to: type=local,dest=/tmp/.buildx-debian-cache-new,mode=max | |
context: . | |
file: ./latest/debian/Dockerfile | |
labels: ${{ steps.debian-meta.outputs.labels }} | |
platforms: linux/amd64,linux/386 | |
pull: true | |
push: ${{ !env.ACT && github.ref == 'refs/heads/main' }} | |
tags: ${{ steps.debian-meta.outputs.tags }} | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-debian-cache | |
mv /tmp/.buildx-debian-cache-new /tmp/.buildx-debian-cache | |
- name: Update Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' && always() }} | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
klei-tools version: ${{ steps.general.outputs.klei-tools-version }} | |
ktools version: ${{ matrix.image.ktools_version }} | |
status: ${{ job.status }} | |
timestamp: ${{ steps.slack.outputs.slack-timestamp }} |