Release house.jux/exceptions "2024.06.07" #6
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: 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 }} |