From 458bee010a776893c38d490e80fd02f9791b88c9 Mon Sep 17 00:00:00 2001
From: Markus Pesch <markus.pesch@cryptic.systems>
Date: Fri, 9 May 2025 11:38:53 +0200
Subject: [PATCH] fix(ci): replace drone with gitea actions

---
 .drone.yml                                    | 359 ------------------
 .gitea/workflows/build.yaml                   |  29 ++
 .gitea/workflows/markdown-linters.yaml        |  22 ++
 .gitea/workflows/release.yaml                 |  53 +++
 .../update-docker-hub-description.yaml        |  22 ++
 Dockerfile.archlinux                          |   1 -
 Dockerfile.centos                             |  25 --
 Dockerfile.debian                             |  44 ---
 Dockerfile.fedora                             |  26 --
 Dockerfile.ubuntu                             |  44 ---
 README.md                                     |  41 +-
 build.sh                                      |  16 -
 12 files changed, 140 insertions(+), 542 deletions(-)
 delete mode 100644 .drone.yml
 create mode 100644 .gitea/workflows/build.yaml
 create mode 100644 .gitea/workflows/markdown-linters.yaml
 create mode 100644 .gitea/workflows/release.yaml
 create mode 100644 .gitea/workflows/update-docker-hub-description.yaml
 delete mode 100644 Dockerfile.centos
 delete mode 100644 Dockerfile.debian
 delete mode 100644 Dockerfile.fedora
 delete mode 100644 Dockerfile.ubuntu
 delete mode 100755 build.sh

diff --git a/.drone.yml b/.drone.yml
deleted file mode 100644
index d7271dd..0000000
--- a/.drone.yml
+++ /dev/null
@@ -1,359 +0,0 @@
----
-kind: pipeline
-type: kubernetes
-name: linter
-
-platform:
-  os: linux
-  arch: amd64
-
-steps:
-- name: markdown lint
-  commands:
-  - markdownlint *.md
-  image: git.cryptic.systems/volker.raschek/markdownlint:0.33.0
-  resources:
-    limits:
-      cpu: 150
-      memory: 150M
-
-- name: email-notification
-  environment:
-    PLUGIN_HOST:
-      from_secret: smtp_host
-    PLUGIN_USERNAME:
-      from_secret: smtp_username
-    PLUGIN_PASSWORD:
-      from_secret: smtp_password
-    PLUGIN_FROM:
-      from_secret: smtp_mail_address
-  image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
-  resources:
-    limits:
-      cpu: 150
-      memory: 150M
-  when:
-    status:
-    - changed
-    - failure
-
-trigger:
-  event:
-    exclude:
-    - tag
-
----
-kind: pipeline
-type: docker
-name: archlinux
-
-platform:
-  os: linux
-  arch: amd64
-
-steps:
-- name: archlinux
-  image: docker.io/volkerraschek/build-image:latest
-  commands:
-  - ./build.sh archlinux latest
-  environment:
-    CONTAINER_IMAGE_REGISTRY_PASSWORD:
-      from_secret: container_image_registry_password
-  volumes:
-  - name: docker_socket
-    path: /var/run/docker.sock
-
-- name: notify
-  image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
-  environment:
-    PLUGIN_HOST:
-      from_secret: smtp_host
-    PLUGIN_USERNAME:
-      from_secret: smtp_username
-    PLUGIN_PASSWORD:
-      from_secret: smtp_password
-    PLUGIN_FROM:
-      from_secret: smtp_mail_address
-  when:
-    status:
-    - changed
-    - failure
-
-trigger:
-  when:
-    branch:
-    - master
-    event:
-    - push
-    - cron
-
-volumes:
-- name: docker_socket
-  host:
-    path: /var/run/docker.sock
-
----
-kind: pipeline
-type: docker
-name: centos
-
-platform:
-  os: linux
-  arch: amd64
-
-steps:
-- name: centos7
-  image: docker.io/volkerraschek/build-image:latest
-  commands:
-  - ./build.sh centos 7
-  environment:
-    CONTAINER_IMAGE_REGISTRY_PASSWORD:
-      from_secret: container_image_registry_password
-  volumes:
-  - name: docker_socket
-    path: /var/run/docker.sock
-
-- name: notify
-  image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
-  environment:
-    PLUGIN_HOST:
-      from_secret: smtp_host
-    PLUGIN_USERNAME:
-      from_secret: smtp_username
-    PLUGIN_PASSWORD:
-      from_secret: smtp_password
-    PLUGIN_FROM:
-      from_secret: smtp_mail_address
-  when:
-    status:
-    - changed
-    - failure
-
-trigger:
-  when:
-    branch:
-    - master
-    event:
-    - push
-    - cron
-
-volumes:
-- name: docker_socket
-  host:
-    path: /var/run/docker.sock
-
----
-kind: pipeline
-type: docker
-name: debian
-
-platform:
-  os: linux
-  arch: amd64
-
-steps:
-- name: 8-slim
-  image: docker.io/volkerraschek/build-image:latest
-  commands:
-  - ./build.sh debian 8-slim
-  environment:
-    CONTAINER_IMAGE_REGISTRY_PASSWORD:
-      from_secret: container_image_registry_password
-  volumes:
-  - name: docker_socket
-    path: /var/run/docker.sock
-
-- name: 9-slim
-  image: docker.io/volkerraschek/build-image:latest
-  commands:
-  - ./build.sh debian 9-slim
-  environment:
-    CONTAINER_IMAGE_REGISTRY_PASSWORD:
-      from_secret: container_image_registry_password
-  volumes:
-  - name: docker_socket
-    path: /var/run/docker.sock
-
-- name: 10-slim
-  image: docker.io/volkerraschek/build-image:latest
-  commands:
-  - ./build.sh debian 10-slim
-  environment:
-    CONTAINER_IMAGE_REGISTRY_PASSWORD:
-      from_secret: container_image_registry_password
-  volumes:
-  - name: docker_socket
-    path: /var/run/docker.sock
-
-- name: 11-slim
-  image: docker.io/volkerraschek/build-image:latest
-  commands:
-  - ./build.sh debian 11-slim
-  environment:
-    CONTAINER_IMAGE_REGISTRY_PASSWORD:
-      from_secret: container_image_registry_password
-  volumes:
-  - name: docker_socket
-    path: /var/run/docker.sock
-
-- name: notify
-  image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
-  environment:
-    PLUGIN_HOST:
-      from_secret: smtp_host
-    PLUGIN_USERNAME:
-      from_secret: smtp_username
-    PLUGIN_PASSWORD:
-      from_secret: smtp_password
-    PLUGIN_FROM:
-      from_secret: smtp_mail_address
-  when:
-    status:
-    - changed
-    - failure
-
-trigger:
-  when:
-    branch:
-    - master
-    event:
-    - push
-    - cron
-
-volumes:
-- name: docker_socket
-  host:
-    path: /var/run/docker.sock
-
----
-kind: pipeline
-type: docker
-name: fedora
-
-platform:
-  os: linux
-  arch: amd64
-
-steps:
-- name: fedora-33
-  image: docker.io/volkerraschek/build-image:latest
-  commands:
-  - ./build.sh fedora 33
-  environment:
-    CONTAINER_IMAGE_REGISTRY_PASSWORD:
-      from_secret: container_image_registry_password
-  volumes:
-  - name: docker_socket
-    path: /var/run/docker.sock
-
-- name: fedora-34
-  image: docker.io/volkerraschek/build-image:latest
-  commands:
-  - ./build.sh fedora 34
-  environment:
-    CONTAINER_IMAGE_REGISTRY_PASSWORD:
-      from_secret: container_image_registry_password
-  volumes:
-  - name: docker_socket
-    path: /var/run/docker.sock
-
-- name: notify
-  image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
-  environment:
-    PLUGIN_HOST:
-      from_secret: smtp_host
-    PLUGIN_USERNAME:
-      from_secret: smtp_username
-    PLUGIN_PASSWORD:
-      from_secret: smtp_password
-    PLUGIN_FROM:
-      from_secret: smtp_mail_address
-  when:
-    status:
-    - changed
-    - failure
-
-trigger:
-  when:
-    branch:
-    - master
-    event:
-    - push
-    - cron
-
-volumes:
-- name: docker_socket
-  host:
-    path: /var/run/docker.sock
-
----
-kind: pipeline
-type: docker
-name: ubuntu
-
-platform:
-  os: linux
-  arch: amd64
-
-steps:
-- name: ubuntu-16.04
-  image: docker.io/volkerraschek/build-image:latest
-  commands:
-  - ./build.sh ubuntu 16.04
-  environment:
-    CONTAINER_IMAGE_REGISTRY_PASSWORD:
-      from_secret: container_image_registry_password
-  volumes:
-  - name: docker_socket
-    path: /var/run/docker.sock
-
-- name: ubuntu-18.04
-  image: docker.io/volkerraschek/build-image:latest
-  commands:
-  - ./build.sh ubuntu 18.04
-  environment:
-    CONTAINER_IMAGE_REGISTRY_PASSWORD:
-      from_secret: container_image_registry_password
-  volumes:
-  - name: docker_socket
-    path: /var/run/docker.sock
-
-- name: ubuntu-20.04
-  image: docker.io/volkerraschek/build-image:latest
-  commands:
-  - ./build.sh ubuntu 20.04
-  environment:
-    CONTAINER_IMAGE_REGISTRY_PASSWORD:
-      from_secret: container_image_registry_password
-  volumes:
-  - name: docker_socket
-    path: /var/run/docker.sock
-
-- name: notify
-  image: git.cryptic.systems/volker.raschek/drone-email:0.1.5
-  environment:
-    PLUGIN_HOST:
-      from_secret: smtp_host
-    PLUGIN_USERNAME:
-      from_secret: smtp_username
-    PLUGIN_PASSWORD:
-      from_secret: smtp_password
-    PLUGIN_FROM:
-      from_secret: smtp_mail_address
-  when:
-    status:
-    - changed
-    - failure
-
-trigger:
-  when:
-    branch:
-    - master
-    event:
-    - push
-    - cron
-
-volumes:
-- name: docker_socket
-  host:
-    path: /var/run/docker.sock
diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml
new file mode 100644
index 0000000..40a2b8a
--- /dev/null
+++ b/.gitea/workflows/build.yaml
@@ -0,0 +1,29 @@
+name: Build
+
+on:
+  pull_request:
+    types:
+    - opened
+    - reopened
+    - synchronize
+  push:
+    branches:
+    - master
+  workflow_dispatch: {}
+
+jobs:
+  build-arch-linux:
+    runs-on: ubuntu-latest-amd64
+    steps:
+      - uses: actions/checkout@v4.2.2
+      - uses: docker/setup-qemu-action@v3.6.0
+      - uses: docker/setup-buildx-action@v3.10.0
+
+      - name: Build image
+        run: |
+          TAG=latest
+
+          docker buildx build \
+            --file Dockerfile.archlinux \
+            --tag git.cryptic.systems/volker.raschek/latex:${TAG}-archlinux \
+            .
diff --git a/.gitea/workflows/markdown-linters.yaml b/.gitea/workflows/markdown-linters.yaml
new file mode 100644
index 0000000..ae3f47a
--- /dev/null
+++ b/.gitea/workflows/markdown-linters.yaml
@@ -0,0 +1,22 @@
+name: 'Lint Markdown files'
+
+on:
+  pull_request:
+    types:
+    - opened
+    - reopened
+    - synchronize
+  push:
+    branches:
+    - master
+  workflow_dispatch: {}
+
+jobs:
+  markdown-lint:
+    runs-on:
+    - ubuntu-latest
+    steps:
+    - uses: actions/checkout@v4.2.2
+    - uses: DavidAnson/markdownlint-cli2-action@v19.1.0
+      with:
+        globs: '**/*.md'
diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml
new file mode 100644
index 0000000..279702e
--- /dev/null
+++ b/.gitea/workflows/release.yaml
@@ -0,0 +1,53 @@
+name: Release
+
+on:
+  push:
+    tags:
+    - "**"
+
+jobs:
+  push-arch-linux:
+    runs-on: ubuntu-latest-amd64
+    steps:
+      - uses: actions/checkout@v4.2.2
+      - uses: docker/setup-qemu-action@v3.6.0
+      - uses: docker/setup-buildx-action@v3.10.0
+
+      - uses: docker/login-action@v3.4.0
+        with:
+          registry: git.cryptic.systems
+          username: ${{ github.repository_owner }}
+          password: ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }}
+
+      - name: Build and push image
+        run: |
+          TAG=$(echo ${{ github.ref_name }} | sed 's/v//gm')
+
+          docker buildx build \
+            --file Dockerfile.archlinux \
+            --push \
+            --tag git.cryptic.systems/volker.raschek/latex:${TAG}-archlinux \
+            .
+
+  sync-to-hub-docker-io:
+    needs:
+    - push-arch-linux
+    runs-on: ubuntu-latest
+    steps:
+    - name: Copy images to docker.io
+      run: |
+        TAG=$(echo ${{ github.ref_name }} | sed 's/v//gm')
+
+        apt-get update --yes
+        apt-get install --yes skopeo
+
+        for suffix in archlinux; do
+          skopeo copy \
+            --all \
+            --dest-password ${{ secrets.DOCKER_IO_PASSWORD }} \
+            --dest-username ${{ secrets.DOCKER_IO_USERNAME }} \
+            --src-password ${{ secrets.GIT_CRYPTIC_SYSTEMS_PACKAGE_REGISTRY_TOKEN }} \
+            --src-username volker.raschek \
+              docker://git.cryptic.systems/volker.raschek/latex:${TAG}-${suffix} \
+              docker://docker.io/volkerraschek/latex:${TAG}-${suffix}
+        done
\ No newline at end of file
diff --git a/.gitea/workflows/update-docker-hub-description.yaml b/.gitea/workflows/update-docker-hub-description.yaml
new file mode 100644
index 0000000..6551457
--- /dev/null
+++ b/.gitea/workflows/update-docker-hub-description.yaml
@@ -0,0 +1,22 @@
+name: Update Docker Hub Description
+
+on:
+  push:
+    branches:
+    - master
+    paths:
+    - README.md
+  workflow_dispatch: {}
+
+jobs:
+  update-description-on-hub-docker-io:
+    runs-on:
+    - ubuntu-latest
+    steps:
+    - uses: actions/checkout@v4.2.2
+    - uses: peter-evans/dockerhub-description@v4.0.2
+      with:
+        username: ${{ secrets.DOCKER_IO_USERNAME }}
+        password: ${{ secrets.DOCKER_IO_PASSWORD }}
+        repository: volkerraschek/latex
+        readme-filepath: README.md
\ No newline at end of file
diff --git a/Dockerfile.archlinux b/Dockerfile.archlinux
index 74c1e78..516c452 100644
--- a/Dockerfile.archlinux
+++ b/Dockerfile.archlinux
@@ -1,4 +1,3 @@
-# Base-Image
 FROM docker.io/library/archlinux:latest
 
 # Labels
diff --git a/Dockerfile.centos b/Dockerfile.centos
deleted file mode 100644
index ffc0ae4..0000000
--- a/Dockerfile.centos
+++ /dev/null
@@ -1,25 +0,0 @@
-# Build-Arguments
-ARG TAG=latest
-
-# Base-Image
-FROM docker.io/library/centos:${TAG}
-
-# Labels
-LABEL maintainer="Markus Pesch <markus.pesch@cryptic.systems>"
-
-# Runs
-RUN yum update --assumeyes
-RUN yum install --assumeyes \
-      biber \
-      curl \
-      git \
-      gnuplot \
-      latexmk \
-      make \
-      python-pygments \
-      texlive \
-      texlive-*.noarch
-
-# Workspace
-WORKDIR /workspace
-VOLUME [ "/workspace" ]
diff --git a/Dockerfile.debian b/Dockerfile.debian
deleted file mode 100644
index d57f468..0000000
--- a/Dockerfile.debian
+++ /dev/null
@@ -1,44 +0,0 @@
-# Build-Arguments
-ARG TAG=latest
-
-# Base-Image
-FROM docker.io/library/debian:${TAG}
-
-# Labels
-LABEL maintainer="Markus Pesch <markus.pesch@cryptic.systems>"
-
-# Environment
-ENV DEBIAN_FRONTEND="noninteractive"
-
-# set shell
-SHELL [ "/bin/bash", "-c" ]
-
-# Runs
-RUN apt-get update
-RUN apt-get upgrade --yes
-RUN apt-get install --yes \
-      biber \
-      curl \
-      git \
-      gnuplot \
-      latexmk \
-      make \
-      texlive-full
-
-# install distribution specific versions
-RUN case "$(cat /etc/debian_version)" in \
-      11*) \
-        apt-get install --yes python3-pygments \
-      ;; \
-      *) \
-        apt-get install --yes python-pygments \
-      ;; \
-    esac
-
-
-# remove dpkg lists
-RUN rm --recursive --force /var/lib/apt/lists/*
-
-# Workspace
-WORKDIR /workspace
-VOLUME [ "/workspace" ]
diff --git a/Dockerfile.fedora b/Dockerfile.fedora
deleted file mode 100644
index 8c29951..0000000
--- a/Dockerfile.fedora
+++ /dev/null
@@ -1,26 +0,0 @@
-# Build-Arguments
-ARG TAG=latest
-
-# Base-Image
-FROM docker.io/library/fedora:${TAG}
-
-# Labels
-LABEL maintainer="Markus Pesch <markus.pesch@cryptic.systems>"
-
-# Runs
-RUN yum update --assumeyes
-RUN yum install --assumeyes \
-      biber \
-      curl \
-      git \
-      gnuplot \
-      latexmk \
-      make \
-      python-pygments \
-      texlive-collection-bibtexextra \
-      texlive-collection-fontutils \
-      texlive-collection-langeuropean
-
-# Workspace
-WORKDIR /workspace
-VOLUME [ "/workspace" ]
diff --git a/Dockerfile.ubuntu b/Dockerfile.ubuntu
deleted file mode 100644
index 557f84f..0000000
--- a/Dockerfile.ubuntu
+++ /dev/null
@@ -1,44 +0,0 @@
-# Build-Arguments
-ARG TAG=latest
-
-# Base-Image
-FROM docker.io/library/ubuntu:${TAG}
-
-# Labels
-LABEL maintainer="Markus Pesch <markus.pesch@cryptic.systems>"
-
-# Environment
-ENV DEBIAN_FRONTEND="noninteractive"
-
-# set shell
-SHELL [ "/bin/bash", "-c" ]
-
-# Runs
-RUN apt-get update
-RUN apt-get upgrade --yes
-RUN apt-get install --yes \
-      biber \
-      curl \
-      git \
-      gnuplot \
-      latexmk \
-      make \
-      texlive-full \
-      xindy
-
-# install distribution specific versions
-RUN case "$(cat /etc/debian_version)" in \
-      bullseye/sid*) \
-        apt-get install --yes python3-pygments \
-      ;; \
-      *) \
-        apt-get install --yes python-pygments \
-      ;; \
-    esac
-
-# remove dpkg lists
-RUN rm --recursive --force /var/lib/apt/lists/*
-
-# Workspace
-WORKDIR /workspace
-VOLUME [ "/workspace" ]
diff --git a/README.md b/README.md
index 73511e2..619dc4b 100644
--- a/README.md
+++ b/README.md
@@ -1,46 +1,34 @@
-# Docker Latex
+# Latex
 
 [![Docker Pulls](https://img.shields.io/docker/pulls/volkerraschek/latex)](https://hub.docker.com/r/volkerraschek/latex)
 
-This repository, hosted on
-[git.cryptic.systems](https://git.cryptic.systems/volker.raschek/latex-docker),
-contains Dockerfiles to build different container images based on differend base
-images. Any container image has the tex compiler and the minted package
-included. Throught this are all container images able to compile tex source code
-with source code highlighting.
+The repository, hosted on [git.cryptic.systems](https://git.cryptic.systems/volker.raschek/latex-docker), contains
+Dockerfiles to build container images based on different base images. Any container image has the tex compiler and the
+minted package included. The main goal of all container image is to compile the text source code with highlighting
+provided by minted into a PDF file.
 
 ## Images
 
 Available Images:
 
-- volkerraschek/latex:latest-archlinux
-- volkerraschek/latex:latest-debian8-slim
-- volkerraschek/latex:latest-debian9-slim
-- volkerraschek/latex:latest-debian10-slim
-- volkerraschek/latex:latest-fedora-30
-- volkerraschek/latex:latest-fedora-31
-- volkerraschek/latex:latest-centos-7
-- volkerraschek/latex:latest-ubuntu-16.04
-- volkerraschek/latex:latest-ubuntu-18.04
-- volkerraschek/latex:latest-ubuntu-20.04
+- `docker.io/volkerraschek/latex:latest-archlinux`
 
-You can find a complete list of all docker images based on different
-distributions on [Docker Hub](https://hub.docker.com/r/volkerraschek/latex-docker/tags).
+You can find a complete list of all docker images based on different distributions on [Docker
+Hub](https://hub.docker.com/r/volkerraschek/latex-docker/tags).
 
 ## Usage
 
 ### Latexmk
 
-Here is an example based on ubuntu 18.04 to compile a PDF file with `latexmk`
-from `index.tex`. Run this command in your root directory of your Latex files or
-change the `volume` option with the `${PWD}` variable.
+Here is an example based on ubuntu 18.04 to compile a PDF file with `latexmk` from `index.tex`. Run this command in your
+root directory of your Latex files or change the `volume` option with the `${PWD}` variable.
 
 ```bash
 $ docker run \
     --rm \
     --user="$(shell id -u):$(shell id -g)" \
     --net="none" \
-    --volume="${PWD}:/workspace" volkerraschek/latex:latest-ubuntu-18.04 \
+    --volume="${PWD}:/workspace" volkerraschek/latex:latest-archlinux \
     latexmk \
       -shell-escape \
       -synctex=1 \
@@ -51,16 +39,15 @@ $ docker run \
 
 ### pdflatex
 
-Here is a example based on ubuntu 18.04 to compile a PDF file with `pdflatex`
-from `index.tex`.  Run this command in your root directory of your Latex files
-or change the `volume` option with the `${PWD}` variable.
+Here is a example based on ubuntu 18.04 to compile a PDF file with `pdflatex` from `index.tex`.  Run this command in
+your root directory of your Latex files or change the `volume` option with the `${PWD}` variable.
 
 ```bash
 $ docker run \
     --rm \
     --user="$(shell id -u):$(shell id -g)" \
     --net="none" \
-    --volume="${PWD}:/workspace" volkerraschek/latex:latest-ubuntu-18.04 \
+    --volume="${PWD}:/workspace" volkerraschek/latex:latest-archlinux \
     pdflatex \
       -shell-escape \
       -synctex=1 \
diff --git a/build.sh b/build.sh
deleted file mode 100755
index f5e17a1..0000000
--- a/build.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-set -ex
-
-OS=${1:-archlinux}
-VERSION=${2:-latest}
-
-TAG=latest-${OS}-${VERSION}
-if [ "${OS}" = "archlinux" ]; then
-  TAG=latest-${OS}
-fi
-
-docker build --build-arg TAG=${VERSION} --file Dockerfile.${OS} --tag volkerraschek/latex:${TAG} .
-echo ${CONTAINER_IMAGE_REGISTRY_PASSWORD} | docker login docker.io --username volkerraschek --password-stdin
-docker push volkerraschek/latex:${TAG}
-docker image rm volkerraschek/latex:${TAG}
\ No newline at end of file