File tree Expand file tree Collapse file tree 5 files changed +91
-2
lines changed Expand file tree Collapse file tree 5 files changed +91
-2
lines changed Original file line number Diff line number Diff line change 1+ name : Build Plugin zip
2+ on :
3+ push :
4+
5+ jobs :
6+ build-plugin :
7+ runs-on : ubuntu-latest
8+ steps :
9+ - uses : actions/checkout@v4
10+ with :
11+ fetch-depth : 0
12+
13+ - name : Gradle wrapper validate
14+ uses : gradle/actions/wrapper-validation@v4
15+
16+ - name : Setup Java
17+ uses : actions/setup-java@v4
18+ with :
19+ distribution : ' temurin'
20+ java-version : 17
21+ cache : ' gradle'
22+
23+ - name : Install Babashka
24+ uses : DeLaGuardo/setup-clojure@master
25+ with :
26+ bb : ' 1.12.196'
27+
28+ - name : Build plugin
29+ run : bb build-plugin
30+
31+ - name : Prepare Plugin Artifact
32+ id : artifact
33+ shell : bash
34+ run : |
35+ cd ${{ github.workspace }}/build/distributions
36+ FILENAME=`ls *.zip`
37+ unzip "$FILENAME" -d content
38+
39+ echo "filename=${FILENAME:0:-4}" >> $GITHUB_OUTPUT
40+
41+ - name : Upload artifact
42+ uses : actions/upload-artifact@v4
43+ with :
44+ name : ${{ steps.artifact.outputs.filename }}
45+ path : ./build/distributions/content/*/*
Original file line number Diff line number Diff line change 1+ name : Publish plugin
2+
3+ on :
4+ push :
5+ tags :
6+ - ' [0-9]+.[0-9]+.[0-9]+*'
7+
8+ jobs :
9+ publish-plugin :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v4
13+ with :
14+ fetch-depth : 0
15+
16+ - name : Prepare java
17+ uses : actions/setup-java@v1
18+ with :
19+ java-version : 17
20+
21+ - name : Install Babashka
22+ uses : DeLaGuardo/setup-clojure@master
23+ with :
24+ bb : ' 1.12.196'
25+
26+ - name : Publish to Jetbrains
27+ env :
28+ JETBRAINS_TOKEN : ${{ secrets.JETBRAINS_TOKEN }}
29+ run : bb publish-plugin
Original file line number Diff line number Diff line change 11{:paths [" src/scripts" ]
22 :tasks {tag scripts/tag
33 build-plugin scripts/build-plugin
4+ install-plugin scripts/install-plugin
45 publish-plugin scripts/publish-plugin}}
Original file line number Diff line number Diff line change 44
55or
66
7- ` ./gradlew buildPlugin ` to build the plugin, then install it from disk in Intellij, the zip should be on ` ./build/distributions/*.zip ` .
7+ ` bb install-plugin ` to build and install the plugin .
88
99## NREPL
1010
Original file line number Diff line number Diff line change 11(ns scripts
22 (:require
3+ [babashka.fs :as fs]
34 [babashka.tasks :refer [shell]]
45 [clojure.string :as string]))
56
7+ (def version-regex #"pluginVersion = ([0-9]+.[0-9]+.[0-9]+.*)" )
8+
69(defn ^:private replace-in-file [file regex content]
710 (as-> (slurp file) $
811 (string/replace $ regex content)
1720
1821(defn ^:private replace-tag [tag]
1922 (replace-in-file " gradle.properties"
20- #"pluginVersion = [0-9]+.[0-9]+.[0-9]+.*"
23+ version-regex
2124 (format " pluginVersion = %s" tag)))
2225
2326#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var ]}
3639(defn build-plugin []
3740 (shell " ./gradlew buildPlugin" ))
3841
42+ #_{:clj-kondo/ignore [:clojure-lsp/unused-public-var ]}
43+ (defn install-plugin [& [intellij-plugins-path]]
44+ (if-not intellij-plugins-path
45+ (println " Specify the Intellij plugins path\n e.g: bb install-plugin /home/greg/.local/share/JetBrains/IdeaIC2024.3" )
46+ (let [version (last (re-find version-regex (slurp " gradle.properties" )))]
47+ (build-plugin )
48+ (fs/unzip (format " ./build/distributions/clojure-lsp-%s.zip" version)
49+ intellij-plugins-path
50+ {:replace-existing true })
51+ (println " Installed!" ))))
52+
3953#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var ]}
4054(defn publish-plugin []
4155 (shell " ./gradlew clean publishPlugin" ))
You can’t perform that action at this time.
0 commit comments