diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d8df74d..54984f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,3 +29,45 @@ jobs: - name: Run tests run: lein with-profile +1.9:+1.10:+1.11 test + + get-version: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.get-version.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Get version + id: get-version + run: | + echo "version=$(head -n 1 project.clj | sed -e 's/^(defproject.*\"\(.*\)\"$/\1/')" \ + >> "$GITHUB_OUTPUT" + + deploy: + if: ${{ github.event_name == 'push' && + github.ref == 'refs/heads/fix/ci' && + endsWith(needs.get-version.outputs.version, '-SNAPSHOT') }} + needs: [test, get-version] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - name: Setup Clojure + uses: DeLaGuardo/setup-clojure@12.3 + with: + lein: '2.11.1' + + - name: Deploy + env: + CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }} + CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }} + run: lein deploy snapshots + diff --git a/project.clj b/project.clj index 081d936..aff6119 100644 --- a/project.clj +++ b/project.clj @@ -19,4 +19,7 @@ :profiles {:1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} :1.10 {:dependencies [[org.clojure/clojure "1.10.3"]]} :1.11 {:dependencies [[org.clojure/clojure "1.11.1"]]}} + :deploy-repositories [["snapshots" {:url "https://clojars.org/repo/" + :username [:env/clojars_username] + :password [:env/clojars_password]}]] :signing {:gpg-key "roimisia@gmail.com"})