Clojars 用 depstar 和 deps-deploy 發包的記錄

由於考慮 CI 作部署的事情, 在網上問了一下, 有社區的高手給了個方案:html

https://clojureverse.org/t/gi...git

I would expect this to be possible since lein, boot, and CLI/deps.edn all have ways to build an uberjar and publish it to Clojars. (for the latter, see https://github.com/clojure/to... 3 – I use https://github.com/seancorfie... 2 and https://github.com/slipset/de... 4 for build/deploy)

配置 Meyvn 的時候, 安裝過程詢問是否要證書, 選了 NO, 而後就退出了.
後來又嘗試了下 https://github.com/juxt/pack.... 安裝過程就出錯了.github

高手提供的方案是有兩個腳本作打包和發佈, 他使用的, 比較穩定的,apache

https://github.com/seancorfie...
https://github.com/slipset/de...mvc

具體的打包發佈步驟基本對應 https://juxt.pro/blog/posts/p...maven

跑通之後目前的 deps.edn 配置:post

{:paths ["src"]
 :aliases {:depstar {:extra-deps {seancorfield/depstar {:mvn/version "0.5.2"}}
                     :main-opts ["-m" "hf.depstar.jar" "target/lilac.jar"]}
           :deploy {:extra-deps {deps-deploy {:mvn/version "RELEASE"}}
                    :main-opts ["-m" "deps-deploy.deps-deploy" "deploy" "target/lilac.jar"]}
           :install {:extra-deps {deps-deploy {:mvn/version "RELEASE"}}
                     :main-opts ["-m" "deps-deploy.deps-deploy" "install" "target/lilac.jar"]}}}

啓動命令:ui

"m2": "clojure -A:depstar && clojure -A:install",
    "deploy": "clojure -A:depstar && clojure -A:deploy",

pom.xml 文件是 clojure -Spom 生成的, 可是中間內容要修改, 包括增長部分字段,this

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>mvc-works</groupId>
  <artifactId>calcit-workflow</artifactId>
  <version>0.0.1-a1</version>
  <name>calcit-workflow</name>

  <url>https://github.com/mvc-works/calcit-workflow</url>
  <description>TODO</description>
  <scm>
    <url>https://github.com/mvc-works/calcit-workflow</url>
  </scm>

  <dependencies>
    <dependency>
      <groupId>org.clojure</groupId>
      <artifactId>clojure</artifactId>
      <version>1.10.1</version>
    </dependency>
  </dependencies>
  <build>
    <sourceDirectory>src</sourceDirectory>
  </build>
  <repositories>
    <repository>
      <id>clojars</id>
      <url>https://repo.clojars.org/</url>
    </repository>
  </repositories>
</project>

單純 pom.xml 的內容結構是很複雜的, 參考:
https://github.com/seancorfie...
https://github.com/clojure/cl...url

沒有打算提供完整的 pom 文件了. Clojars 上顯示的內容也不完整.
目前只是想作到能發包和使用, 維護儘可能簡單可重複.
畢竟影響到的項目太多了.

另外 deps-deploy 帳號密碼是經過 env 提供的, 具體看 README.對應 CI 來講基本仍是能夠配的, 管理來講倒是不如 token 合適.

相關文章
相關標籤/搜索