name: Check
on:
push:
pull_request:
workflow_dispatch:
jobs:
check:
runs-on: debian
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
java: ['17', '21', '25', '27']
steps:
# actions/checkout discards the server URL's /forgejo path.
- name: Checkout
env:
CHECKOUT_TOKEN: ${{ github.token }}
run: |
git init -q
git remote add origin "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY.git"
auth=$(printf 'x-access-token:%s' "$CHECKOUT_TOKEN" | base64 -w0)
GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.extraHeader \
GIT_CONFIG_VALUE_0="AUTHORIZATION: basic $auth" \
git fetch --no-tags --depth=1 origin "$GITHUB_SHA"
git checkout --detach FETCH_HEAD
- uses: https://github.com/actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
with:
distribution: temurin
java-version: ${{ matrix.java }}
- uses: https://data.forgejo.org/actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.m2/repository
key: maven-${{ matrix.java }}-${{ hashFiles('deps.edn') }}
- name: Install Clojure CLI
run: |
cd "$RUNNER_TEMP"
curl -fsSLO https://download.clojure.org/install/linux-install-1.12.4.1618.sh
bash linux-install-1.12.4.1618.sh --prefix "$RUNNER_TEMP/clojure"
echo "$RUNNER_TEMP/clojure/bin" >> "$GITHUB_PATH"
- name: Test
run: clojure -M:test
- name: Check pass types
if: matrix.java == '25' || matrix.java == '27'
run: clojure -M:check
- name: Build JAR
if: matrix.java == '25'
run: clojure -T:build jar
publish:
needs: check
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
runs-on: debian
timeout-minutes: 5
steps:
- name: Request publication of tested master
env:
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
run: |
curl --fail-with-body --silent --show-error --config - \
--header 'Content-Type: application/json' \
--data "{\"ref\":\"master\",\"inputs\":{\"repository\":\"$GITHUB_REPOSITORY\",\"commit\":\"$GITHUB_SHA\",\"source_run\":\"$GITHUB_RUN_ID\"}}" \
"$GITHUB_SERVER_URL/api/v1/repos/alan/repos-publisher/actions/workflows/publish.yml/dispatches" <<EOF
header = "Authorization: token $PUBLISH_TOKEN"
EOF