From 3013aa33dd201a6fb63e8152979e3cddd89a67be Mon Sep 17 00:00:00 2001
From: Jan Snellman <jan.snellman@liu.se>
Date: Sat, 1 Jun 2024 14:57:51 +0200
Subject: [PATCH] CI med busybox slutade fungera, bytte till alpine

---
 .gitlab-ci.yml |  13 +++
 README.org     |  21 ++++
 publish.el     | 282 ++++++++++++++++++++++++-------------------------
 3 files changed, 175 insertions(+), 141 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c5aad57..df9c141 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -10,3 +10,16 @@ pages:
     expire_in: 1 day
   rules:
     - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
+
+image: alpine:latest
+
+pages:
+  stage: deploy
+  script:
+  - echo 'Inget att utföra...'
+  artifacts:
+    paths:
+    - public
+    expire_in: 1 day
+  rules:
+    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
diff --git a/README.org b/README.org
index deae48f..59581d6 100644
--- a/README.org
+++ b/README.org
@@ -59,6 +59,27 @@ pages:
 
 #+end_src
 
+**** Third attempt stopped working <2024-06-01 Sat>
+
+*** Fourth attempt
+
+#+begin_src yaml :tangle .gitlab-ci.yml
+image: alpine:latest
+
+pages:
+  stage: deploy
+  script:
+  - echo 'Inget att utföra...'
+  artifacts:
+    paths:
+    - public
+    expire_in: 1 day
+  rules:
+    - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH
+
+#+end_src
+
+
 ** publish.el script
 #+begin_src emacs-lisp :tangle publish.el
             ;; publish.el --- Publish org-mode project on Gitlab Pages
diff --git a/publish.el b/publish.el
index 4ebe739..efe170e 100644
--- a/publish.el
+++ b/publish.el
@@ -1,141 +1,141 @@
-;; publish.el --- Publish org-mode project on Gitlab Pages
-;; Author: Rasmus, modified by Jan Snellman
-
-(add-to-list 'load-path "/usr/share/emacs/site-lisp")
-
-(defun get-latest-org ()
-  "Download the latest Org if the shipped version is too old."
-  (let* ((default-directory "/tmp/")
-         (org-dir "/tmp/org-mode/")
-         (dev-url "https://code.orgmode.org/bzg/org-mode/archive/master.tar.gz")
-         (htmlize-url "https://raw.githubusercontent.com/hniksic/emacs-htmlize/master/htmlize.el")
-         (devp (zerop (shell-command (concat "wget -q --spider " dev-url)))))
-    (unless (file-directory-p org-dir)
-      (url-copy-file
-       (if devp dev-url "https://orgmode.org/org-latest.tar.gz")
-       "org.tar.gz" t)
-      (shell-command "tar xfz org.tar.gz;"))
-    (unless (file-exists-p (concat org-dir "lisp/org-loaddefs.el"))
-      (shell-command (concat (concat "cd " org-dir ";")
-                             "make autoloads")))
-    (unless (featurep 'htmlize)
-      (url-copy-file htmlize-url (concat org-dir "lisp/htmlize.el") t))
-    (add-to-list 'load-path (concat org-dir "lisp/"))
-    (add-to-list 'load-path (concat org-dir "contrib/lisp/"))))
-
-;; If you need the latest version of Org run this command
-;; (get-latest-org)
-
-;; You can also install Org via package.el.
-
-;; (setq package-selected-packages '(org))
-;; (package-initialize)
-;; (package-install-selected-packages)
-
-(require 'org)
-(require 'ox-publish)
-
-;; Disable time-stamps
-;; (setq org-publish-use-timestamps-flag nil)
-
-(setq user-full-name "Jan Snellman")
-(setq user-mail-address "jan.snellman@liu.se")
-
-(setq org-export-with-section-numbers nil
-      org-export-with-smart-quotes t
-      org-export-with-toc nil)
-
-(setq org-html-divs '((preamble "header" "top")
-                      (content "main" "content")
-                      (postamble "footer" "postamble"))
-      org-html-container-element "section"
-      org-html-metadata-timestamp-format "%Y-%m-%d"
-      org-html-checkbox-type 'html
-      org-html-html5-fancy t
-      org-html-doctype "html5")
-
-(defvar site-attachments (regexp-opt '("jpg" "jpeg" "gif" "png" "svg"
-                                       "ico" "cur" "css" "js" "woff" "html" "pdf")))
-
-(defvar site-images (regexp-opt '("jpg" "jpeg" "gif" "png" "svg"
-                                  "ico" )))
-
-
-(setq org-publish-project-alist
-      '(("tata54-org"
-         :base-directory "./homepage"
-         :base-extension "org"
-         :recursive t
-         :publishing-function org-html-publish-to-html
-         :publishing-directory "./public"
-         :exclude "public/"
-         :auto-sitemap t
-         :sitemap-filename "sitemap.org"
-         :sitemap-title "Kurshemsida"
-         :sitemap-file-entry-format "%d *%t*"
-         :html-head-extra "<link rel=\"icon\" type=\"image/x-icon\" href=\"/favicon.ico\"/>"
-         :auto-preamble nil
-         :html-preamble "<div id=\"navbar\" style =\"text-align: center;\">
-              <a href='https://liu.se'>LiU</a> -
-              <a href='https://liu.se/organisation/liu/mai'>MAI</a> -
-              <a href='https://liu.se/organisation/liu/mai'>Grundutbildning</a> -
-              <a href='https://courses.mai.liu.se/Lists/html/'>Kurser</a> -
-              <a href='index.html'>TATA54</a></div>"
-         :sitemap-style list
-         :sitemap-sort-files anti-chronologically)
-
-        ;; ("tata54-static"
-        ;;  :base-directory "./homepage"
-        ;;  :exclude "public/"
-        ;;  :base-extension site-attachments
-        ;;  :publishing-directory "./public"
-        ;;  :publishing-function org-publish-attachment
-        ;;  :recursive t)
-
-        ("tata54-literature"
-         :base-directory "./homepage/literature"
-         :exclude "public/"
-         :base-extension "pdf"
-         :publishing-directory "./public/literature"
-         :publishing-function org-publish-attachment
-         :recursive t)
-
-        ("tata54-exams"
-         :base-directory "./homepage/exams"
-         :exclude "public/"
-         :base-extension "pdf"
-         :publishing-directory "./public/exams"
-         :publishing-function org-publish-attachment
-         :recursive t)
-
-        ("tata54-lectures"
-         :base-directory "./homepage/lectures"
-         :exclude "public/"
-         :base-extension "pdf"
-         :publishing-directory "./public/lectures"
-         :publishing-function org-publish-attachment
-         :recursive t)
-
-        ("tata54-labs"
-         :base-directory "./homepage/labs"
-         :exclude "public/"
-         :base-extension "html\\|ipynb"
-         :publishing-directory "./public/labs"
-         :publishing-function org-publish-attachment
-         :recursive t)
-
-        ("tata54-images"
-         :base-directory "./homepage/img"
-         :exclude "public/"
-         :base-extension  "png\\|svg\\|jpg\\|jpeg"
-         :publishing-directory "./public/img"
-         :publishing-function org-publish-attachment
-         :recursive t)
-
-
-        ("tata54" :components ("tata54-org"
-                               "tata54-literature"
-                               "tata54-exams"
-                               "tata54-lectures"
-                               "tata54-labs"
-                               "tata54-images"))))
+            ;; publish.el --- Publish org-mode project on Gitlab Pages
+            ;; Author: Rasmus, modified by Jan Snellman
+
+            (add-to-list 'load-path "/usr/share/emacs/site-lisp")
+
+            (defun get-latest-org ()
+              "Download the latest Org if the shipped version is too old."
+              (let* ((default-directory "/tmp/")
+                     (org-dir "/tmp/org-mode/")
+                     (dev-url "https://code.orgmode.org/bzg/org-mode/archive/master.tar.gz")
+                     (htmlize-url "https://raw.githubusercontent.com/hniksic/emacs-htmlize/master/htmlize.el")
+                     (devp (zerop (shell-command (concat "wget -q --spider " dev-url)))))
+                (unless (file-directory-p org-dir)
+                  (url-copy-file
+                   (if devp dev-url "https://orgmode.org/org-latest.tar.gz")
+                   "org.tar.gz" t)
+                  (shell-command "tar xfz org.tar.gz;"))
+                (unless (file-exists-p (concat org-dir "lisp/org-loaddefs.el"))
+                  (shell-command (concat (concat "cd " org-dir ";")
+                                         "make autoloads")))
+                (unless (featurep 'htmlize)
+                  (url-copy-file htmlize-url (concat org-dir "lisp/htmlize.el") t))
+                (add-to-list 'load-path (concat org-dir "lisp/"))
+                (add-to-list 'load-path (concat org-dir "contrib/lisp/"))))
+
+            ;; If you need the latest version of Org run this command
+            ;; (get-latest-org)
+
+            ;; You can also install Org via package.el.
+
+            ;; (setq package-selected-packages '(org))
+            ;; (package-initialize)
+            ;; (package-install-selected-packages)
+
+            (require 'org)
+            (require 'ox-publish)
+
+            ;; Disable time-stamps
+            ;; (setq org-publish-use-timestamps-flag nil)
+
+            (setq user-full-name "Jan Snellman")
+            (setq user-mail-address "jan.snellman@liu.se")
+
+            (setq org-export-with-section-numbers nil
+                  org-export-with-smart-quotes t
+                  org-export-with-toc nil)
+
+            (setq org-html-divs '((preamble "header" "top")
+                                  (content "main" "content")
+                                  (postamble "footer" "postamble"))
+                  org-html-container-element "section"
+                  org-html-metadata-timestamp-format "%Y-%m-%d"
+                  org-html-checkbox-type 'html
+                  org-html-html5-fancy t
+                  org-html-doctype "html5")
+
+            (defvar site-attachments (regexp-opt '("jpg" "jpeg" "gif" "png" "svg"
+                                                   "ico" "cur" "css" "js" "woff" "html" "pdf")))
+
+            (defvar site-images (regexp-opt '("jpg" "jpeg" "gif" "png" "svg"
+                                              "ico" )))
+
+
+            (setq org-publish-project-alist
+                  '(("tata54-org"
+                     :base-directory "./homepage"
+                     :base-extension "org"
+                     :recursive t
+                     :publishing-function org-html-publish-to-html
+                     :publishing-directory "./public"
+                     :exclude "public/"
+                     :auto-sitemap t
+                     :sitemap-filename "sitemap.org"
+                     :sitemap-title "Kurshemsida"
+                     :sitemap-file-entry-format "%d *%t*"
+                     :html-head-extra "<link rel=\"icon\" type=\"image/x-icon\" href=\"/favicon.ico\"/>"
+                     :auto-preamble nil
+                     :html-preamble "<div id=\"navbar\" style =\"text-align: center;\">
+                          <a href='https://liu.se'>LiU</a> -
+                          <a href='https://liu.se/organisation/liu/mai'>MAI</a> -
+                          <a href='https://liu.se/organisation/liu/mai'>Grundutbildning</a> -
+                          <a href='https://courses.mai.liu.se/Lists/html/'>Kurser</a> -
+                          <a href='index.html'>TATA54</a></div>"
+                     :sitemap-style list
+                     :sitemap-sort-files anti-chronologically)
+
+                    ;; ("tata54-static"
+                    ;;  :base-directory "./homepage"
+                    ;;  :exclude "public/"
+                    ;;  :base-extension site-attachments
+                    ;;  :publishing-directory "./public"
+                    ;;  :publishing-function org-publish-attachment
+                    ;;  :recursive t)
+
+                    ("tata54-literature"
+                     :base-directory "./homepage/literature"
+                     :exclude "public/"
+                     :base-extension "pdf"
+                     :publishing-directory "./public/literature"
+                     :publishing-function org-publish-attachment
+                     :recursive t)
+
+                    ("tata54-exams"
+                     :base-directory "./homepage/exams"
+                     :exclude "public/"
+                     :base-extension "pdf"
+                     :publishing-directory "./public/exams"
+                     :publishing-function org-publish-attachment
+                     :recursive t)
+
+                    ("tata54-lectures"
+                     :base-directory "./homepage/lectures"
+                     :exclude "public/"
+                     :base-extension "pdf"
+                     :publishing-directory "./public/lectures"
+                     :publishing-function org-publish-attachment
+                     :recursive t)
+
+                    ("tata54-labs"
+                     :base-directory "./homepage/labs"
+                     :exclude "public/"
+                     :base-extension "html\\|ipynb"
+                     :publishing-directory "./public/labs"
+                     :publishing-function org-publish-attachment
+                     :recursive t)
+
+                    ("tata54-images"
+                     :base-directory "./homepage/img"
+                     :exclude "public/"
+                     :base-extension  "png\\|svg\\|jpg\\|jpeg"
+                     :publishing-directory "./public/img"
+                     :publishing-function org-publish-attachment
+                     :recursive t)
+
+
+                    ("tata54" :components ("tata54-org"
+                                           "tata54-literature"
+                                           "tata54-exams"
+                                           "tata54-lectures"
+                                           "tata54-labs"
+                                           "tata54-images"))))
-- 
GitLab