-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (53 loc) · 1.58 KB
/
deploy-clojars.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
name: Deploy to Clojars
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0 # Fetch all history
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Install Leiningen
run: |
curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > lein
chmod a+x lein
sudo mv lein /usr/local/bin/
- name: Check for changes and SNAPSHOT
id: check_changes
run: |
changed_libs=()
for dir in $(find . -name 'project.clj' -exec dirname {} \;); do
if git diff --quiet HEAD~1 HEAD -- $dir; then
echo "No changes in $dir"
else
if grep -q SNAPSHOT $dir/project.clj; then
echo "SNAPSHOT version in $dir, skipping deployment"
else
echo "Changes detected in $dir and no SNAPSHOT version"
changed_libs+=($dir)
fi
fi
done
echo "changed_libs=${changed_libs[@]}" >> $GITHUB_ENV
- name: Deploy changed libs
if: ${{ env.changed_libs != '' }}
run: |
IFS=' ' read -r -a libs <<< "${{ env.changed_libs }}"
for lib in "${libs[@]}"; do
echo "Deploying $lib"
cd $lib
lein deploy clojars
cd ..
done
env:
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }}
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }}