diff --git a/.editorconfig b/.editorconfig index 299d8bf..1911dc8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,3 +15,6 @@ indent_size = 2 [*.{yml,yaml}] indent_size = 2 + +[*.lua] +indent_size = 2 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 52b0deb..587648f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -76,6 +76,9 @@ jobs: distribution: temurin java-version: 21 + - name: Set up Git Hub Pages + uses: actions/configure-pages@v5 + - name: Cache Gradle packages uses: actions/cache@v4 with: @@ -91,16 +94,40 @@ jobs: - name: Install PCRE run: sudo apt-get install -y libpcre2-8-0 - - name: Build + - name: Build artifacts run: ./gradlew build jacocoAggregatedTestReport -Dpcre2.library.path=/usr/lib/x86_64-linux-gnu + - name: Build docs + run: | + sudo apt-get install -y pandoc + + mkdir -p build/gh-pages + pandoc -f gfm -t html5 -s --shift-heading-level-by=-1 --lua-filter=gh-pages/filter.lua \ + -o build/gh-pages/index.html README.md + pandoc -f gfm -t html5 -s --shift-heading-level-by=-1 --lua-filter=gh-pages/filter.lua \ + -o build/gh-pages/pcre2-api.html PCRE2_API.md + + mkdir -p build/gh-pages/docs + pandoc -f markdown -t html5 -s --shift-heading-level-by=-1 --lua-filter=gh-pages/filter.lua \ + -o build/gh-pages/docs/index.html gh-pages/docs/index.md + cp -a api/build/docs/. build/gh-pages/docs/api + cp -a lib/build/docs/. build/gh-pages/docs/lib + cp -a jna/build/docs/. build/gh-pages/docs/jna + cp -a ffm/build/docs/. build/gh-pages/docs/ffm + cp -a regex/build/docs/. build/gh-pages/docs/regex + - name: Codecov uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} file: build/reports/jacoco/jacocoAggregatedTestReport/jacoco.xml - - name: Publish + - name: Upload GitHub Pages artifact + uses: actions/upload-pages-artifact@v3 + with: + path: build/gh-pages + + - name: Publish artifacts if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} env: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} @@ -109,3 +136,28 @@ jobs: OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} run: ./gradlew publish -Ppcre4j.version=${{ github.ref_name }}-SNAPSHOT + + publish-github-pages: + if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} + + runs-on: ubuntu-latest + + permissions: + contents: read + pages: write + id-token: write + + needs: + - package + + environment: + name: github-pages + url: ${{ steps.publish-github-pages.outputs.page_url }} + + steps: + - name: Set up Git Hub Pages + uses: actions/configure-pages@v5 + + - name: Publish GitHub Pages + id: publish-github-pages + uses: actions/deploy-pages@v4 diff --git a/gh-pages/docs/index.md b/gh-pages/docs/index.md new file mode 100644 index 0000000..c844c1b --- /dev/null +++ b/gh-pages/docs/index.md @@ -0,0 +1,7 @@ +# PCRE4J Package Index + +- [`org.pcre4j.api`](./api) +- [`org.pcre4j.lib`](./lib) +- [`org.pcre4j.jna`](./jna) +- [`org.pcre4j.ffm`](./ffm) +- [`org.pcre4j.regex`](./ffm) diff --git a/gh-pages/filter.lua b/gh-pages/filter.lua new file mode 100644 index 0000000..04f54e1 --- /dev/null +++ b/gh-pages/filter.lua @@ -0,0 +1,8 @@ +function Link(el) + if string.match(el.target, "%.md") then + el.target = string.gsub(el.target, "%.md", ".html") + el.target = string.lower(el.target) + el.target = string.gsub(el.target, "_", "-") + end + return el +end