Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Release

on:
workflow_dispatch:

jobs:
release:
name: Create release
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.version.outputs.nextStrict }}

permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0

- name: Get next version
id: version
uses: ietf-tools/semver-action@c90370b2958652d71c06a3484129a4d423a6d8a8
with:
token: ${{ github.token }}
branch: ${{ github.event.repository.default_branch }}
noNewCommitBehavior: "warn"
noVersionBumpBehavior: "warn"
patchList: fix, bugfix, perf, refactor, test, tests, chore, build

- name: Create and push tag
if: ${{ steps.version.outputs.nextStrict }}
run: |
set -euo pipefail
git config user.name "fossifybot[bot]"
git config user.email "212866877+fossifybot[bot]@users.noreply.github.com"
new_version="${{ steps.version.outputs.nextStrict }}"
echo "Creating tag: $new_version"
git tag -a "$new_version" -m "$new_version"
git push origin "$new_version"
echo "Created and pushed tag: $new_version"

trigger_jitpack:
needs: release
runs-on: ubuntu-latest
if: ${{ needs.release.outputs.tag }}
steps:
- name: Trigger JitPack build
run: |
TAG='${{ needs.release.outputs.tag }}'
echo "Requesting JitPack build for ${TAG}"
curl -fsSL --max-time 180 "https://jitpack.io/org/fossify/java-mammoth/${TAG}/java-mammoth-${TAG}.pom" || true

- name: Wait for JitPack to finish
run: |
TAG='${{ needs.release.outputs.tag }}'
URL="https://jitpack.io/org/fossify/java-mammoth/${TAG}/java-mammoth-${TAG}.pom"

echo "Waiting for JitPack to build ${TAG}..."
sleep 240
for i in $(seq 1 13); do
echo "Attempt $i: checking ${URL}?check=${i}"
if curl -fsSIL --max-time 300 "${URL}?check=${i}" > /dev/null 2>&1; then
echo "JitPack build successful!"
exit 0
fi

sleep 60
done

echo "Timed out waiting for JitPack build."
exit 1
1 change: 1 addition & 0 deletions jitpack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jdk: openjdk17
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
import org.zwobble.mammoth.internal.util.PassThroughException;
Expand Down Expand Up @@ -33,8 +35,14 @@ private static void parseInputSource(InputSource inputSource, SimpleSaxHandler h
parserFactory.setNamespaceAware(true);
try {
parserFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
parserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
parserFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
try {
parserFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
} catch (SAXNotRecognizedException | SAXNotSupportedException ignored) {
}
try {
parserFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
} catch (SAXNotRecognizedException | SAXNotSupportedException ignored) {
}
SAXParser saxParser = parserFactory.newSAXParser();
XMLReader xmlReader = saxParser.getXMLReader();
xmlReader.setContentHandler(new DefaultHandler() {
Expand Down
Loading