diff --git a/.github/workflows/deploy_to_maven_central.yml b/.github/workflows/deploy_to_maven_central.yml index e352487..cf7c731 100644 --- a/.github/workflows/deploy_to_maven_central.yml +++ b/.github/workflows/deploy_to_maven_central.yml @@ -9,6 +9,7 @@ concurrency: cancel-in-progress: true permissions: contents: write + pages: write id-token: write env: @@ -22,7 +23,6 @@ jobs: runs-on: ubuntu-latest outputs: INITIAL_MAIN_POSITION: ${{ steps.create-tag.outputs.INITIAL_MAIN_POSITION }} - INITIAL_GH_PAGES_POSITION: ${{ steps.create-tag.outputs.INITIAL_GH_PAGES_POSITION }} TAG: ${{ steps.create-tag.outputs.TAG }} VERSION: ${{ steps.create-tag.outputs.VERSION }} STAGING_PROFILE_ID: ${{ steps.parse-profile-id.outputs.STAGING_PROFILE_ID }} @@ -154,20 +154,43 @@ jobs: - name: Generate Javadoc run: | ./mvnw --batch-mode -V -e -pl '!dropwizard,!jersey' verify javadoc:aggregate - mkdir --parents "${{ needs.open-release.outputs.VERSION }}/docs" - mv target/reports/apidocs "${{ needs.open-release.outputs.VERSION }}/docs/api" + VERSION=${{ needs.open-release.outputs.VERSION }} + rm -rf "docs/api/${VERSION}" + mkdir --parents "docs/api/${VERSION}" + mv target/reports/apidocs/* "docs/api/${VERSION}" - name: Commit changes run: | - git checkout gh-pages -f - echo "INITIAL_GH_PAGES_POSITION=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" - git add "${{ needs.open-release.outputs.VERSION }}/docs/api" - git commit -m "Released version ${{ needs.open-release.outputs.VERSION }}" + git checkout ${{ github.ref_name }} -f + git add "docs/api/${{ needs.open-release.outputs.VERSION }}" + git commit -m "Publishing Javadoc for version ${{ needs.open-release.outputs.VERSION }}" git push + javadoc: + name: Javadoc + needs: deploy + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + - name: Setup Pages + uses: actions/configure-pages@v5 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: "docs/api" + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + close-release: name: Close release - needs: [ open-release, deploy ] + needs: [ open-release, deploy, javadoc ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -202,7 +225,7 @@ jobs: # Cleanup on failure: https://stackoverflow.com/a/74562058/14731 on-failure: name: On failure - needs: [ open-release, deploy, close-release ] + needs: [ open-release, deploy, javadoc, close-release ] runs-on: ubuntu-latest if: ${{ failure() || cancelled() }} steps: @@ -248,15 +271,3 @@ jobs: if: needs.open-release.outputs.TAG != '' run: | git push --delete origin ${{ needs.open-release.outputs.TAG }} - - - name: Restore the gh-pages ref to its original position - if: needs.open-release.outputs.INITIAL_GH_PAGES_POSITION != '' - run: | - CURRENT_REF_POSITION=$(git rev-parse HEAD) - if [ "${CURRENT_REF_POSITION}" != "${{ needs.open-release.outputs.INITIAL_GH_PAGES_POSITION }}" ]; then - git reset --hard ${{ needs.open-release.outputs.INITIAL_GH_PAGES_POSITION }} - if [ "${{ github.ref_type }}" == "tag" ]; then - git ${{ github.ref_type }} -f ${{ github.ref_name }} - fi - git push -f origin ${{ github.ref_name }} - fi \ No newline at end of file diff --git a/README.md b/README.md index 5abca9f..4f42b2b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.cowwoc.pouch/core/badge.svg)](https://search.maven.org/search?q=g:com.github.cowwoc.pouch) [![API](https://img.shields.io/badge/api_docs-5B45D5.svg)](http://cowwoc.github.io/pouch/6.1/docs/api/) [![Changelog](https://img.shields.io/badge/changelog-A345D5.svg)](docs/changelog.md) +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.cowwoc.pouch/core/badge.svg)](https://search.maven.org/search?q=g:com.github.cowwoc.pouch) [![API](https://img.shields.io/badge/api_docs-5B45D5.svg)](http://cowwoc.github.io/pouch/6.2/) [![Changelog](https://img.shields.io/badge/changelog-A345D5.svg)](docs/changelog.md) [![build-status](../../workflows/Build/badge.svg)](../../actions?query=workflow%3Abuild) # pouch Pouch: Inversion of Control for the Masses @@ -20,7 +20,7 @@ To get started, add this Maven dependency: com.github.cowwoc.pouch core - 6.1 + 6.2 ``` @@ -140,7 +140,7 @@ For example, notice how `AbstractDatabaseScope.getRunMode()` delegates to `JvmSc When running in a multithreaded environment, such as a web server, you might want to wait for ongoing HTTP requests to complete before shutting down the server. You can use the -[ConcurrentChildScopes](https://cowwoc.github.io/pouch/6.1/docs/api/com.github.cowwoc.pouch.core/com/github/cowwoc/pouch/core/ConcurrentChildScopes.html) +[ConcurrentChildScopes](https://cowwoc.github.io/pouch/6.2/com.github.cowwoc.pouch.core/com/github/cowwoc/pouch/core/ConcurrentChildScopes.html) class to implement this as follows: ```java @@ -408,7 +408,7 @@ public final class TestDataSourceFactory extends ConcurrentLazyFactory +* [Reference](https://cowwoc.github.io/pouch/6.2/com.github.cowwoc.pouch.core/com/github/cowwoc/pouch/core/Reference.html) <-> [Supplier](https://guava.dev/releases/32.1.1-jre/api/docs/com/google/common/base/Supplier.html) -* [ConstantReference](https://cowwoc.github.io/pouch/6.1/docs/api/com.github.cowwoc.pouch.core/com/github/cowwoc/pouch/core/ConstantReference.html) +* [ConstantReference](https://cowwoc.github.io/pouch/6.2/com.github.cowwoc.pouch.core/com/github/cowwoc/pouch/core/ConstantReference.html) <-> [Suppliers.ofInstance()](https://guava.dev/releases/32.1.1-jre/api/docs/com/google/common/base/Suppliers.html#ofInstance-T-) -* [LazyReference](https://cowwoc.github.io/pouch/6.1/docs/api/com.github.cowwoc.pouch.core/com/github/cowwoc/pouch/core/LazyReference.html) <-> +* [LazyReference](https://cowwoc.github.io/pouch/6.2/com.github.cowwoc.pouch.core/com/github/cowwoc/pouch/core/LazyReference.html) <-> [Suppliers.memoize()](https://guava.dev/releases/32.1.1-jre/api/docs/com/google/common/base/Suppliers.html#memoize-com.google.common.base.Supplier-) While it is true @@ -175,13 +175,13 @@ For example: 1. [Suppliers.memoize()](https://guava.dev/releases/32.1.1-jre/api/docs/com/google/common/base/Suppliers.html#memoize-com.google.common.base.Supplier-) doesn't provide a mechanism for checking whether the underlying value has been initialized. This is important because, when implementing - [Factory.close()](https://cowwoc.github.io/pouch/6.1/docs/api/com.github.cowwoc.pouch.core/com/github/cowwoc/pouch/core/Factory.html#close()), + [Factory.close()](https://cowwoc.github.io/pouch/6.2/com.github.cowwoc.pouch.core/com/github/cowwoc/pouch/core/Factory.html#close()), you'll want to avoid initializing values that have never been initialized before. 2. This library provides convenience classes such as - [LazyFactory](https://cowwoc.github.io/pouch/6.1/docs/api/com.github.cowwoc.pouch.core/com/github/cowwoc/pouch/core/LazyFactory.html) + [LazyFactory](https://cowwoc.github.io/pouch/6.2/com.github.cowwoc.pouch.core/com/github/cowwoc/pouch/core/LazyFactory.html) which unifies classes - [LazyReference](https://cowwoc.github.io/pouch/6.1/docs/api/com.github.cowwoc.pouch.core/com/github/cowwoc/pouch/core/LazyReference.html) - and [Closeable](http://docs.oracle.com/javase/8/docs/api/java/io/Closeable.html) into a single class. + [LazyReference](https://cowwoc.github.io/pouch/6.2/com.github.cowwoc.pouch.core/com/github/cowwoc/pouch/core/LazyReference.html) + and [Closeable](http://docs.oracle.com/javase/8/java/io/Closeable.html) into a single class. The size of the Guava library is 2.8MB. Pouch is easier to use and smaller with a file size of 18KB.