diff --git a/.github/workflows/pages-repo.yml b/.github/workflows/pages-repo.yml index bfacff7..0bea977 100644 --- a/.github/workflows/pages-repo.yml +++ b/.github/workflows/pages-repo.yml @@ -5,10 +5,18 @@ on: branches: [ main, "rework/v2" ] workflow_dispatch: +# Shared with publish-javadoc.yml so Maven-layout and JavaDoc pushes to +# Pinont/singularity-maven gh-pages do not race. +concurrency: + group: singularity-maven-gh-pages + cancel-in-progress: false + jobs: deploy: # Pushes the maven repo layout to Pinont/singularity-maven (Pages-served, # anonymous reads). Accumulative: previously published versions are kept. + # JavaDoc HTML is published separately under /javadoc/ by publish-javadoc.yml + # — do not delete that tree. runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/publish-javadoc.yml b/.github/workflows/publish-javadoc.yml new file mode 100644 index 0000000..6cf3aad --- /dev/null +++ b/.github/workflows/publish-javadoc.yml @@ -0,0 +1,111 @@ +name: publish-javadoc + +# Generates JavaDoc HTML and copies it into Pinont/singularity-maven (gh-pages), +# which is served at https://maven.pinont.me. Paths are under /javadoc/ so they +# never collide with the Maven layout (io/, com/) written by pages-repo.yml. +# +# Do not enable GitHub Pages on Pinont/SingularityLib — that URL is the +# portfolio (pinont.me), not this library. + +on: + push: + branches: [ main ] + workflow_dispatch: + +concurrency: + group: singularity-maven-gh-pages + cancel-in-progress: false + +jobs: + javadoc: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@v4 + + - name: Setup JDK 25 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '25' + + - name: Install annotation processor module + run: mvn -q install -DskipTests -f singularitylib-processor/pom.xml + + - name: Resolve project version + id: ver + run: | + VERSION=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version) + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + + - name: Generate JavaDoc HTML + run: mvn -q javadoc:javadoc -DskipTests + + - name: Locate JavaDoc output + id: javadoc + run: | + if [ -d target/site/apidocs ]; then + echo "dir=target/site/apidocs" >> "$GITHUB_OUTPUT" + elif [ -d target/reports/apidocs ]; then + echo "dir=target/reports/apidocs" >> "$GITHUB_OUTPUT" + else + echo "JavaDoc output not found under target/site or target/reports" >&2 + find target -type d -name apidocs || true + exit 1 + fi + + - name: Clone singularity-maven (gh-pages) + run: | + git clone --depth 1 --branch gh-pages \ + "https://x-access-token:${{ secrets.MAVEN_REPO_TOKEN }}@github.com/Pinont/singularity-maven.git" \ + singularity-maven-pages + + - name: Stage JavaDoc (Maven group paths untouched) + env: + VERSION: ${{ steps.ver.outputs.version }} + JAVADOC_DIR: ${{ steps.javadoc.outputs.dir }} + run: | + set -euo pipefail + ROOT="singularity-maven-pages" + DEST="${ROOT}/javadoc/singularitylib" + mkdir -p "${DEST}" + cp docs/javadoc-root.html "${ROOT}/javadoc/index.html" + cp docs/index.html "${DEST}/index.html" + rm -rf "${DEST}/${VERSION}" + mkdir -p "${DEST}/${VERSION}" + cp -R "${JAVADOC_DIR}/." "${DEST}/${VERSION}/" + # Copy, not symlink — GitHub Pages does not follow git symlinks. + rm -rf "${DEST}/latest" + mkdir -p "${DEST}/latest" + cp -R "${JAVADOC_DIR}/." "${DEST}/latest/" + touch "${ROOT}/.nojekyll" + + - name: Commit and push + run: | + set -euo pipefail + cd singularity-maven-pages + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add javadoc .nojekyll + if git diff --cached --quiet; then + echo "No javadoc changes" + exit 0 + fi + git commit -m "docs: javadoc singularitylib ${{ steps.ver.outputs.version }} (${{ github.sha }})" + for i in 1 2 3 4; do + git pull --rebase origin gh-pages + if git push origin gh-pages; then + exit 0 + fi + sleep $((i * 4)) + done + echo "Failed to push gh-pages after retries" >&2 + exit 1 + + - name: Trigger Pages rebuild + run: | + curl -s -X POST \ + -H "Authorization: Bearer ${{ secrets.MAVEN_REPO_TOKEN }}" \ + -H "Accept: application/vnd.github+json" \ + https://api.github.com/repos/Pinont/singularity-maven/pages/builds -o /dev/null -w "%{http_code}\n" diff --git a/README.md b/README.md index 71edf87..d2b8f66 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # SingularityLib -[![](https://img.shields.io/github/license/pinont/singularitylib)](https://github.com/Pinont/SingularityLib/blob/main/LICENSE) [![](https://img.shields.io/maven-central/v/io.github.pinont/singularitylib)](https://central.sonatype.com/artifact/io.github.pinont/singularitylib) [![](https://github.com/Pinont/SingularityLib/actions/workflows/build.yml/badge.svg)](https://github.com/Pinont/SingularityLib/actions/workflows/build.yml) +[![](https://img.shields.io/github/license/pinont/singularitylib)](https://github.com/Pinont/SingularityLib/blob/main/LICENSE) [![](https://img.shields.io/maven-central/v/io.github.pinont/singularitylib)](https://central.sonatype.com/artifact/io.github.pinont/singularitylib) [![](https://github.com/Pinont/SingularityLib/actions/workflows/build.yml/badge.svg)](https://github.com/Pinont/SingularityLib/actions/workflows/build.yml) [![JavaDoc](https://img.shields.io/badge/docs-JavaDoc-e0a54b)](https://maven.pinont.me/javadoc/singularitylib/) + +**Docs / JavaDoc:** [maven.pinont.me/javadoc/singularitylib](https://maven.pinont.me/javadoc/singularitylib/) · [latest API](https://maven.pinont.me/javadoc/singularitylib/latest/) · [javadoc.io fallback](https://javadoc.io/doc/io.github.pinont/singularitylib/2.0.0) A fork of [ExperienceLib](https://github.com/pinont/ExperienceLib) diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..6e6c033 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,168 @@ + + + + + + SingularityLib — Docs + + + + +
+

PaperMC · JDK 25 · Maven Central

+

SingularityLib

+

+ Core API library for Paper plugins: commands, config, GUI, items, entities, + compile-time auto-registration, database helpers, and Discord JDA bootstrap. +

+ +
+ Browse JavaDoc + Install (README) + Maven Central +
+ +
+

Maven Central coordinates

+

Releases are on Central — no extra repository block. Scope provided; the lib loads as its own server plugin.

+
<dependency>
+  <groupId>io.github.pinont</groupId>
+  <artifactId>singularitylib</artifactId>
+  <version>2.0.0</version>
+  <scope>provided</scope>
+</dependency>
+
+ +
+

JavaDoc

+

+ HTML is generated from src/main/java and published on + maven.pinont.me next to the snapshot Maven repository. +

+ +
+ +
+

Snapshots

+

+ Dev builds: io.github.pinont:singularitylib:2.0.0-SNAPSHOT from + https://maven.pinont.me. + Full install notes, including the bootstrap paper-plugin.yml snippet, are in the + README. +

+
+ + +
+ + diff --git a/docs/javadoc-root.html b/docs/javadoc-root.html new file mode 100644 index 0000000..1beaa64 --- /dev/null +++ b/docs/javadoc-root.html @@ -0,0 +1,12 @@ + + + + + Singularity JavaDoc + + + + +

JavaDoc: SingularityLib

+ + diff --git a/pom.xml b/pom.xml index a3621cc..c8082f2 100644 --- a/pom.xml +++ b/pom.xml @@ -170,18 +170,20 @@ - + org.apache.maven.plugins maven-javadoc-plugin 3.7.0 + + false + false + attach-javadocs jar - - false -