-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (61 loc) · 2.55 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Clojure JAR CI/CD
on:
pull_request:
branches: [ master, main ]
push:
branches: [ master, main ]
jobs:
test-and-build:
runs-on: ubuntu-latest
if: contains(fromJSON('["janetacarr"]'), github.actor) # Limit to active contributors
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Cache Clojure dependencies
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/deps.edn') }}
restore-keys: ${{ runner.os }}-m2
- name: Install Clojure
run: |
curl -L -O https://github.com/clojure/brew-install/releases/latest/download/posix-install.sh
chmod +x posix-install.sh
sudo ./posix-install.sh
- name: Test with tools.build
run: clojure -M:test
build-jar-and-publish:
runs-on: ubuntu-latest
needs: test-and-build
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Cache Clojure dependencies
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/deps.edn') }}
restore-keys: ${{ runner.os }}-m2
- name: Install Clojure
run: |
curl -L -O https://github.com/clojure/brew-install/releases/latest/download/posix-install.sh
chmod +x posix-install.sh
sudo ./posix-install.sh
- name: Build JAR
run: clojure -T:build jar
- name: Create settings.xml for Maven
run: |
echo '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd"><servers><server><id>github</id><username>${{ secrets.GH_USERNAME }}</username><password>${{ secrets.GH_PAT }}</password></server><server><id>clojars</id><username>${{ secrets.CLOJARS_USERNAME }}</username><password>${{ secrets.CLOJARS_TOKEN }}</password></server></servers></settings>' > $HOME/.m2/settings.xml
- name: Publish JAR to GitHub Packages
run: clojure -T:build deploy :repository github
- name: Publish JAR to Clojars
run: clojure -T:build deploy :repository clojars