|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +jobs: |
| 7 | + release: |
| 8 | + name: Create release |
| 9 | + runs-on: ubuntu-latest |
| 10 | + outputs: |
| 11 | + tag: ${{ steps.version.outputs.nextStrict }} |
| 12 | + |
| 13 | + permissions: |
| 14 | + contents: write |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout repository |
| 18 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
| 21 | + |
| 22 | + - name: Get next version |
| 23 | + id: version |
| 24 | + uses: ietf-tools/semver-action@c90370b2958652d71c06a3484129a4d423a6d8a8 |
| 25 | + with: |
| 26 | + token: ${{ github.token }} |
| 27 | + branch: ${{ github.event.repository.default_branch }} |
| 28 | + noNewCommitBehavior: "warn" |
| 29 | + noVersionBumpBehavior: "warn" |
| 30 | + patchList: fix, bugfix, perf, refactor, test, tests, chore, build |
| 31 | + |
| 32 | + - name: Create and push tag |
| 33 | + if: ${{ steps.version.outputs.nextStrict }} |
| 34 | + run: | |
| 35 | + set -euo pipefail |
| 36 | + git config user.name "fossifybot[bot]" |
| 37 | + git config user.email "212866877+fossifybot[bot]@users.noreply.github.com" |
| 38 | + new_version="${{ steps.version.outputs.nextStrict }}" |
| 39 | + echo "Creating tag: $new_version" |
| 40 | + git tag -a "$new_version" -m "$new_version" |
| 41 | + git push origin "$new_version" |
| 42 | + echo "Created and pushed tag: $new_version" |
| 43 | +
|
| 44 | + trigger_jitpack: |
| 45 | + needs: release |
| 46 | + runs-on: ubuntu-latest |
| 47 | + if: ${{ needs.release.outputs.tag }} |
| 48 | + steps: |
| 49 | + - name: Trigger JitPack build |
| 50 | + run: | |
| 51 | + TAG='${{ needs.release.outputs.tag }}' |
| 52 | + echo "Requesting JitPack build for ${TAG}" |
| 53 | + curl -fsSL --max-time 180 "https://jitpack.io/org/fossify/java-mammoth/${TAG}/java-mammoth-${TAG}.pom" || true |
| 54 | +
|
| 55 | + - name: Wait for JitPack to finish |
| 56 | + run: | |
| 57 | + TAG='${{ needs.release.outputs.tag }}' |
| 58 | + URL="https://jitpack.io/org/fossify/java-mammoth/${TAG}/java-mammoth-${TAG}.pom" |
| 59 | +
|
| 60 | + echo "Waiting for JitPack to build ${TAG}..." |
| 61 | + sleep 240 |
| 62 | + for i in $(seq 1 13); do |
| 63 | + echo "Attempt $i: checking ${URL}?check=${i}" |
| 64 | + if curl -fsSIL --max-time 300 "${URL}?check=${i}" > /dev/null 2>&1; then |
| 65 | + echo "JitPack build successful!" |
| 66 | + exit 0 |
| 67 | + fi |
| 68 | +
|
| 69 | + sleep 60 |
| 70 | + done |
| 71 | +
|
| 72 | + echo "Timed out waiting for JitPack build." |
| 73 | + exit 1 |
0 commit comments