Add tag-and-mirror CI job for GitHub mirror
The mirror URL no longer lives in config since the CI job handles
tagging and pushing directly, making the config entry unnecessary.

Assisted-by: GLM-5.1 via pi
change xqrttypomppnxxzzpolovnvqtnvkvukn
commit cf7b1c9792b0068a0e1219a78fc1224902b21b4d
author Alpha Chen <alpha@kejadlen.dev>
date
parent zqzrwwor
diff --git a/.quire/ci.fnl b/.quire/ci.fnl
index 8b13789..fa424b7 100644
--- a/.quire/ci.fnl
+++ b/.quire/ci.fnl
@@ -1 +1,24 @@
+(local {: job} (require :quire.ci))
+(local mirror-url "https://github.com/kejadlen/quire.git")
 
+(job :tag-and-mirror [:quire/push]
+     (fn [{: sh : secret : jobs}]
+       (let [{: sha} (jobs :quire/push)
+             date (-> (sh "date --utc +%Y-%m-%d")
+                      (. :stdout)
+                      (: :gsub "\n$" ""))
+             tag (.. :v date "+" (sha:sub 1 12))
+             token (secret :github_token)
+             encoded (-> (sh "printf '%s' \"$T\" | base64"
+                             {:env {:T (.. "x-access-token:" token)}})
+                         (. :stdout)
+                         (: :gsub "\n$" ""))
+             auth-header (.. "Authorization: Basic " encoded)]
+         (sh [:git :tag tag sha])
+         (sh [:git
+              :-c
+              (.. :http.extraHeader= auth-header)
+              :push
+              :--porcelain
+              mirror-url
+              (.. :refs/tags/ tag)]))))
diff --git a/.quire/config.fnl b/.quire/config.fnl
index 0bfeb2e..0967ef4 100644
--- a/.quire/config.fnl
+++ b/.quire/config.fnl
@@ -1 +1 @@
-{:mirror {:url "https://github.com/kejadlen/quire.git"}}
+{}