Add publishing to the clojars #40
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
paths: | |
- ".github/workflows/**" | |
- "src/**" | |
- ".cljfmt.edn" | |
- "bb.edn" | |
- "build.clj" | |
- "deps.edn" | |
- "tests.edn" | |
- "version" | |
pull_request: | |
paths: | |
- ".github/workflows/**" | |
- "src/**" | |
- ".cljfmt.edn" | |
- "bb.edn" | |
- "build.clj" | |
- "deps.edn" | |
- "tests.edn" | |
- "version" | |
jobs: | |
test: | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup clojure tools | |
uses: DeLaGuardo/[email protected] | |
with: | |
bb: latest | |
cli: latest | |
clj-kondo: latest | |
cljfmt: latest | |
- name: Setup openjdk | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: "21" | |
- name: Setup nodejs | |
uses: actions/[email protected] | |
with: | |
node-version: "22.11.0" | |
- name: Setup variables | |
id: tenet | |
run: | | |
TENET_VERSION=$(bb version) | |
echo "version=${TENET_VERSION}" >> $GITHUB_OUTPUT | |
- name: Install deps | |
run: bb setup | |
- name: Cache deps | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.m2/repository | |
~/.gitlibs | |
~/.clojure | |
~/.cpcache | |
key: ubuntu-deps-${{ hashFiles('deps.edn') }} | |
restore-keys: ubuntu-deps- | |
- name: Run linters | |
run: bb lint | |
- name: Run tests | |
run: bb test | |
- name: Upload coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
path: coverage | |
name: coverage-${{ steps.tenet.outputs.version }} | |
- name: Publish coverage | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage/codecov.json | |
flags: clojure,clojurescript | |
os: ubuntu | |
fail_ci_if_error: false | |
verbose: true | |
publish: | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup openjdk | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "temurin" | |
java-version: "21" | |
- name: Setup clojure tools | |
uses: DeLaGuardo/[email protected] | |
with: | |
bb: latest | |
cli: latest | |
- name: Cache deps | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.m2/repository | |
~/.gitlibs | |
~/.clojure | |
~/.cpcache | |
key: ubuntu-deps-${{ hashFiles('deps.edn') }} | |
restore-keys: ubuntu-deps- | |
- name: Setup variables | |
id: tenet | |
run: | | |
TENET_VERSION=$(bb version) | |
echo "version=${TENET_VERSION}" >> $GITHUB_OUTPUT | |
echo 'CLOJARS_USERNAME=${{ secrets.CLOJARS_USERNAME }}' >> $GITHUB_ENV; | |
echo 'CLOJARS_PASSWORD=${{ secrets.CLOJARS_PASSWORD }}' >> $GITHUB_ENV; | |
- name: Build jar | |
run: bb build jar | |
- name: Upload jar | |
uses: actions/upload-artifact@v4 | |
with: | |
path: target/tenet.jar | |
name: tenet-${{ steps.tenet.outputs.version }}.jar | |
- name: Publish jar | |
run: bb deploy |