Skip to content

Trigger JitPack Build on Release #28

Trigger JitPack Build on Release

Trigger JitPack Build on Release #28

Workflow file for this run

name: Trigger JitPack Build on Release
on:
release:
types: [published, created]
workflow_run:
workflows: ["Create Release on Push"]
types:
- completed
jobs:
jitpack-build:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' || github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version from release or pom.xml
id: get_version
run: |
if [ "${{ github.event_name }}" == "release" ]; then
VERSION="${{ github.event.release.tag_name }}"
else
VERSION=$(grep -m1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/')
fi
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Detected version: $VERSION"
- name: Trigger JitPack Build
env:
REPO_OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
run: |
echo "Triggering JitPack build for ${REPO_OWNER}/${REPO_NAME} @ ${VERSION}"
# JitPack build is triggered by accessing the artifact URL
echo "JitPack URL: https://jitpack.io/com/github/${REPO_OWNER}/${REPO_NAME}/${VERSION}/build.log"
# Trigger the build by making a request to the POM file
curl -s -o /dev/null -w "HTTP Status: %{http_code}\n" \
"https://jitpack.io/com/github/${REPO_OWNER}/${REPO_NAME}/${VERSION}/${REPO_NAME}-${VERSION}.pom" || true
echo "JitPack build triggered!"
- name: Wait and Check Build Status
env:
REPO_OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
VERSION: ${{ steps.get_version.outputs.VERSION }}
run: |
echo "Waiting for JitPack to process the build..."
sleep 60
# Check the build log
BUILD_LOG_URL="https://jitpack.io/com/github/${REPO_OWNER}/${REPO_NAME}/${VERSION}/build.log"
echo "Build log URL: $BUILD_LOG_URL"
echo "---"
curl -s "$BUILD_LOG_URL" | tail -50 || echo "Build log not available yet"