Change tags in DOCKERHUB.md and README.md #57
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 }}/ktools | |
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)" | |
echo "Dockerfiles version: $dockerfiles_version" | |
echo "Dockerfiles version (short): $dockerfiles_version_short" | |
{ | |
echo "dockerfiles-version=$dockerfiles_version" | |
echo "dockerfiles-version-short=$dockerfiles_version_short" | |
} >> "$GITHUB_OUTPUT" | |
- name: Send Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' }} | |
id: slack | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
ImageMagick version: ${{ matrix.image.imagemagick_version }} | |
ktools version: ${{ matrix.image.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: prefix=official-,onlatest=true | |
images: | | |
${{ env.DOCKERHUB_REPOSITORY }} | |
ghcr.io/${{ env.DOCKERHUB_REPOSITORY }} | |
labels: [email protected] | |
tags: | | |
type=raw,value=${{ matrix.image.version }}-imagemagick-${{ matrix.image.imagemagick_version }}-debian | |
type=raw,value=${{ matrix.image.version }}-debian | |
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}-imagemagick-{1}-debian-{2}', matrix.image.version, matrix.image.imagemagick_version, steps.general.outputs.dockerfiles-version-short) }} | |
restore-keys: | | |
${{ matrix.image.version }}-imagemagick-${{ matrix.image.imagemagick_version }}-debian-${{ steps.general.outputs.dockerfiles-version-short }} | |
${{ matrix.image.version }}-imagemagick-${{ matrix.image.imagemagick_version }}-debian- | |
- name: Build a Debian image | |
uses: docker/build-push-action@v6 | |
id: debian | |
with: | |
build-args: | | |
IMAGEMAGICK_IMAGE_PREFIX=${{ matrix.image.imagemagick_legacy && 'legacy-' || '' }} | |
IMAGEMAGICK_VERSION=${{ matrix.image.imagemagick_version }} | |
KTOOLS_VERSION=${{ matrix.image.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: Prepare Docker meta for an Alpine image | |
uses: docker/metadata-action@v5 | |
id: alpine-meta | |
with: | |
images: | | |
${{ env.DOCKERHUB_REPOSITORY }} | |
ghcr.io/${{ env.DOCKERHUB_REPOSITORY }} | |
flavor: | | |
latest=${{ matrix.image.latest || 'false' }} | |
prefix=official-,onlatest=true | |
labels: [email protected] | |
tags: | | |
type=raw,value=${{ matrix.image.version }}-imagemagick-${{ matrix.image.imagemagick_version }}-alpine | |
type=raw,value=${{ matrix.image.version }}-alpine | |
type=raw,value=${{ matrix.image.version }} | |
${{ matrix.image.latest && 'type=raw,value=alpine' || '' }} | |
${{ matrix.image.latest && 'type=raw,prefix=,value=official' || '' }} | |
- name: Cache Docker layers (Alpine) | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-alpine-cache | |
key: ${{ format('{0}-imagemagick-{1}-alpine-{2}', matrix.image.version, matrix.image.imagemagick_version, steps.general.outputs.dockerfiles-version-short) }} | |
restore-keys: | | |
${{ matrix.image.version }}-imagemagick-${{ matrix.image.imagemagick_version }}-alpine-${{ steps.general.outputs.dockerfiles-version-short }} | |
${{ matrix.image.version }}-imagemagick-${{ matrix.image.imagemagick_version }}-alpine- | |
- name: Build an Alpine image | |
uses: docker/build-push-action@v6 | |
id: alpine | |
with: | |
build-args: | | |
IMAGEMAGICK_IMAGE_PREFIX=${{ matrix.image.imagemagick_legacy && 'legacy-' || '' }} | |
IMAGEMAGICK_VERSION=${{ matrix.image.imagemagick_version }} | |
KTOOLS_VERSION=${{ matrix.image.version }} | |
cache-from: type=local,src=/tmp/.buildx-alpine-cache | |
cache-to: type=local,dest=/tmp/.buildx-alpine-cache-new,mode=max | |
context: . | |
file: ./official/alpine/Dockerfile | |
labels: ${{ steps.alpine-meta.outputs.labels }} | |
platforms: linux/amd64,linux/386 | |
pull: true | |
push: ${{ !env.ACT && github.ref == 'refs/heads/main' }} | |
tags: ${{ steps.alpine-meta.outputs.tags }} | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-debian-cache /tmp/.buildx-alpine-cache | |
mv /tmp/.buildx-debian-cache-new /tmp/.buildx-debian-cache | |
mv /tmp/.buildx-alpine-cache-new /tmp/.buildx-alpine-cache | |
- name: Update Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' && always() }} | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
ImageMagick version: ${{ matrix.image.imagemagick_version }} | |
ktools version: ${{ matrix.image.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)" | |
echo "Dockerfiles version: $dockerfiles_version" | |
echo "Dockerfiles version (short): $dockerfiles_version_short" | |
{ | |
echo "dockerfiles-version=$dockerfiles_version" | |
echo "dockerfiles-version-short=$dockerfiles_version_short" | |
} >> "$GITHUB_OUTPUT" | |
- name: Send Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' }} | |
id: slack | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
ImageMagick version: ${{ matrix.image.imagemagick_version }} | |
ktools version: ${{ matrix.image.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: | |
images: | | |
${{ env.DOCKERHUB_REPOSITORY }} | |
ghcr.io/${{ env.DOCKERHUB_REPOSITORY }} | |
labels: [email protected] | |
tags: | | |
type=raw,value=${{ matrix.image.version }}-imagemagick-${{ matrix.image.imagemagick_version }}-debian | |
type=raw,value=${{ matrix.image.version }}-debian | |
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}-imagemagick-{1}-debian-{2}', matrix.image.version, matrix.image.imagemagick_version, steps.general.outputs.dockerfiles-version-short) }} | |
restore-keys: | | |
${{ matrix.image.version }}-imagemagick-${{ matrix.image.imagemagick_version }}-debian-${{ steps.general.outputs.dockerfiles-version-short }} | |
${{ matrix.image.version }}-imagemagick-${{ matrix.image.imagemagick_version }}-debian- | |
- name: Build a Debian image | |
uses: docker/build-push-action@v6 | |
id: debian | |
with: | |
build-args: | | |
IMAGEMAGICK_IMAGE_PREFIX=${{ matrix.image.imagemagick_legacy && 'legacy-' || '' }} | |
IMAGEMAGICK_VERSION=${{ matrix.image.imagemagick_version }} | |
KTOOLS_VERSION=${{ matrix.image.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: Prepare Docker meta for an Alpine image | |
uses: docker/metadata-action@v5 | |
id: alpine-meta | |
with: | |
images: | | |
${{ env.DOCKERHUB_REPOSITORY }} | |
ghcr.io/${{ env.DOCKERHUB_REPOSITORY }} | |
flavor: latest=${{ matrix.image.latest || 'false' }} | |
labels: [email protected] | |
tags: | | |
type=raw,value=${{ matrix.image.version }}-imagemagick-${{ matrix.image.imagemagick_version }}-alpine | |
type=raw,value=${{ matrix.image.version }}-alpine | |
type=raw,value=${{ matrix.image.version }} | |
${{ matrix.image.latest && 'type=raw,value=alpine' || '' }} | |
- name: Cache Docker layers (Alpine) | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-alpine-cache | |
key: ${{ format('{0}-imagemagick-{1}-alpine-{2}', matrix.image.version, matrix.image.imagemagick_version, steps.general.outputs.dockerfiles-version-short) }} | |
restore-keys: | | |
${{ matrix.image.version }}-imagemagick-${{ matrix.image.imagemagick_version }}-alpine-${{ steps.general.outputs.dockerfiles-version-short }} | |
${{ matrix.image.version }}-imagemagick-${{ matrix.image.imagemagick_version }}-alpine- | |
- name: Build an Alpine image | |
uses: docker/build-push-action@v6 | |
id: alpine | |
with: | |
build-args: | | |
IMAGEMAGICK_IMAGE_PREFIX=${{ matrix.image.imagemagick_legacy && 'legacy-' || '' }} | |
IMAGEMAGICK_VERSION=${{ matrix.image.imagemagick_version }} | |
KTOOLS_VERSION=${{ matrix.image.version }} | |
cache-from: type=local,src=/tmp/.buildx-alpine-cache | |
cache-to: type=local,dest=/tmp/.buildx-alpine-cache-new,mode=max | |
context: . | |
file: ./latest/alpine/Dockerfile | |
labels: ${{ steps.alpine-meta.outputs.labels }} | |
platforms: linux/amd64,linux/386 | |
pull: true | |
push: ${{ !env.ACT && github.ref == 'refs/heads/main' }} | |
tags: ${{ steps.alpine-meta.outputs.tags }} | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-debian-cache /tmp/.buildx-alpine-cache | |
mv /tmp/.buildx-debian-cache-new /tmp/.buildx-debian-cache | |
mv /tmp/.buildx-alpine-cache-new /tmp/.buildx-alpine-cache | |
- name: Update Slack notification | |
uses: codedsolar/slack-action@v1 | |
if: ${{ github.event_name != 'pull_request' && always() }} | |
with: | |
fields: | | |
{STATUS} | |
{REF} | |
ImageMagick version: ${{ matrix.image.imagemagick_version }} | |
ktools version: ${{ matrix.image.version }} | |
status: ${{ job.status }} | |
timestamp: ${{ steps.slack.outputs.slack-timestamp }} |