implement retryIfResult #596
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: Release with Jitpack | |
on: | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
- refs/tags/* | |
tags: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Build | |
run: ./gradlew check | |
- name: Archive test reports | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-reports | |
path: build/reports/tests/ | |
- name: Release | |
run: | | |
echo "Triggering JitPack build" | |
PACKAGES_URL="https://jitpack.io/com/github/${GITHUB_REPOSITORY}/${GITHUB_REF#refs/tags/}/" | |
PACKAGES_FILE="packages.txt" | |
touch ${PACKAGES_FILE} | |
# Try the URL 6 times before failing | |
count=1 | |
until [[ $count -gt 6 ]] || grep -q build.log ${PACKAGES_FILE} ; do | |
echo "Attempt ${count}/6" | |
STATUS=$(curl -s -o packages.txt -w "%{http_code}" --max-time 900 ${PACKAGES_URL}) | |
let count+=1 | |
if [[ "${STATUS}" -gt 399 ]]; then | |
sleep 30 | |
fi | |
done | |
echo "::group::Files Available" | |
echo $(cat ${PACKAGES_FILE}) | |
echo "::endgroup::" | |
if [[ ${STATUS} -gt 399 ]] ; then | |
echo "FAILURE: ${STATUS} response from JitPack" | |
exit 1 | |
fi | |
if: startsWith(github.ref, 'refs/tags') |