Change tags in DOCKERHUB.md and README.md #33
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/**' | |
- 'legacy/**' | |
- .github/workflows/build.yml | |
- versions.json | |
workflow_dispatch: | |
env: | |
DOCKERHUB_REPOSITORY: ${{ github.repository_owner }}/imagemagick | |
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 }} | |
legacy: ${{ steps.set-matrix.outputs.legacy }} | |
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 "legacy=$(jq -cM .legacy <<< "$json")" | |
} >> "$GITHUB_OUTPUT" | |
legacy: | |
needs: prepare | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 1 | |
matrix: | |
image: ${{ fromJSON(needs.prepare.outputs.legacy) }} | |
steps: | |
- name: Check out | |
uses: actions/checkout@v4 | |
- name: Set general outputs | |
id: general | |
run: | | |
dockerfiles_version='${{ hashFiles('legacy/**/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.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=legacy-,onlatest=true | |
images: | | |
${{ env.DOCKERHUB_REPOSITORY }} | |
ghcr.io/${{ env.DOCKERHUB_REPOSITORY }} | |
labels: [email protected] | |
tags: | | |
type=raw,value=${{ matrix.image.version }}-debian | |
${{ matrix.image.latest && 'type=raw,value=debian' || '' }} | |
- name: Cache Docker layers (Debian) | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-debian-cache | |
key: ${{ format('legacy-{0}-debian-{1}', matrix.image.version, steps.general.outputs.dockerfiles-version-short) }} | |
restore-keys: | | |
legacy-${{ matrix.image.version }}-debian-${{ steps.general.outputs.dockerfiles-version-short }} | |
legacy-${{ matrix.image.version }}-debian- | |
- name: Build a Debian image | |
uses: docker/build-push-action@v6 | |
id: debian | |
with: | |
build-args: IMAGEMAGICK_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: ./legacy/debian/Dockerfile | |
labels: ${{ steps.debian-meta.outputs.labels }} | |
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7 | |
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=legacy-,onlatest=true | |
labels: [email protected] | |
tags: | | |
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=legacy' || '' }} | |
- name: Cache Docker layers (Alpine) | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-alpine-cache | |
key: ${{ format('legacy-{0}-alpine-{1}', matrix.image.version, steps.general.outputs.dockerfiles-version-short) }} | |
restore-keys: | | |
legacy-${{ matrix.image.version }}-alpine-${{ steps.general.outputs.dockerfiles-version-short }} | |
legacy-${{ matrix.image.version }}-alpine- | |
- name: Build an Alpine image | |
uses: docker/build-push-action@v6 | |
id: alpine | |
with: | |
build-args: IMAGEMAGICK_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: ./legacy/alpine/Dockerfile | |
labels: ${{ steps.alpine-meta.outputs.labels }} | |
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v7 | |
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.version }} | |
status: ${{ job.status }} | |
timestamp: ${{ steps.slack.outputs.slack-timestamp }} | |
latest: | |
needs: [prepare, legacy] | |
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.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 }}-debian | |
${{ 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}-debian-{1}', matrix.image.version, steps.general.outputs.dockerfiles-version-short) }} | |
restore-keys: | | |
${{ matrix.image.version }}-debian-${{ steps.general.outputs.dockerfiles-version-short }} | |
${{ matrix.image.version }}-debian- | |
- name: Build a Debian image | |
uses: docker/build-push-action@v6 | |
id: debian | |
with: | |
build-args: IMAGEMAGICK_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,linux/arm64,linux/arm/v7 | |
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 }}-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}-alpine-{1}', matrix.image.version, steps.general.outputs.dockerfiles-version-short) }} | |
restore-keys: | | |
${{ matrix.image.version }}-alpine-${{ steps.general.outputs.dockerfiles-version-short }} | |
${{ matrix.image.version }}-alpine- | |
- name: Build an Alpine image | |
uses: docker/build-push-action@v6 | |
id: alpine | |
with: | |
build-args: IMAGEMAGICK_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,linux/arm64,linux/arm/v7 | |
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.version }} | |
status: ${{ job.status }} | |
timestamp: ${{ steps.slack.outputs.slack-timestamp }} |