From d1e67f4117bb92760a341c97dde2dc338a474868 Mon Sep 17 00:00:00 2001 From: Jiaqi Liu Date: Sat, 13 Jan 2024 06:40:11 +0800 Subject: [PATCH] Publish Athena to Maven Central (#57) * Publish Athena to Maven Central * Publish Athena to Maven Central --- .github/workflows/ci-cd.yml | 55 +++++++++++++++++++++++++++------ docs/pages/guide/v1/08-start.md | 10 +++--- docs/pages/guide/v1/14-test.md | 2 +- pom.xml | 21 +++++++++++-- 4 files changed, 70 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 440196e0e..11c1a4d91 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -39,18 +39,18 @@ jobs: - uses: actionshub/markdownlint@main with: filesToIgnoreRegex: "docs/node_modules\\/.*" -# markdown-link-check: -# name: Markdown Link Check -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# - uses: gaurav-nelson/github-action-markdown-link-check@v1 -# with: -# use-verbose-mode: "yes" + markdown-link-check: + name: Markdown Link Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + use-verbose-mode: "yes" tests: name: Unit & Integration Tests - needs: [yaml-lint, markdown-lint] + needs: [yaml-lint, markdown-lint, markdown-link-check] runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -131,3 +131,40 @@ jobs: context: athena-examples/athena-example-books push: true tags: ${{ secrets.DOCKERHUB_USERNAME }}/athena-example-books:latest + + maven-release: + name: Publish Athena to Maven Central + if: github.ref == 'refs/heads/master' + needs: tests + runs-on: ubuntu-latest + permissions: + contents: write # allow for pushing tag + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 # https://github.com/actions/checkout/issues/338#issuecomment-732300720 + - name: Set up JDK + uses: QubitPi/hashicorp-aws/hashicorp/webservice/auxiliary/github/actions/jdk-setup@master + - name: Tag for release + run: | + git config --global user.name '$USER' + git config --global user.email '$EMAIL' + .github/tag-for-release.bash + - name: Set release version + run: | + VERSION=$(git describe) + mvn versions:set -DnewVersion=$VERSION -DgenerateBackupPoms=false + mvn versions:update-property -Dproperty=version.athena -DnewVersion=$VERSION -DgenerateBackupPoms=false + - name: Generate settings file + uses: whelk-io/maven-settings-xml-action@v20 + with: + servers: > + [ + { + "id": "ossrh", + "username": "${{ secrets.USERNAME }}", + "password": "${{ secrets.PASSWORD }}" + } + ] + - name: Publish to Maven Central + run: mvn --batch-mode deploy diff --git a/docs/pages/guide/v1/08-start.md b/docs/pages/guide/v1/08-start.md index 926fdbaf3..42f248409 100644 --- a/docs/pages/guide/v1/08-start.md +++ b/docs/pages/guide/v1/08-start.md @@ -203,15 +203,15 @@ The tests contain 2 parts 1. Groovy Spock unit tests on - - [Injected Query DataFetcher](../../../../athena-examples/athena-example-books/src/test/groovy/com/qubitpi/athena/example/books/application/SQLQueryDataFetcherSpec.groovy) - - [Injected Mutation DataFetcher](../../../../athena-examples/athena-example-books/src/test/groovy/com/qubitpi/athena/example/books/application/SQLMutationDataFetcherSpec.groovy) + - [Injected Query DataFetcher](../../../../athena-examples/athena-example-books/src/test/groovy/org/qubitpi/athena/example/books/application/SQLQueryDataFetcherSpec.groovy) + - [Injected Mutation DataFetcher](../../../../athena-examples/athena-example-books/src/test/groovy/org/qubitpi/athena/example/books/application/SQLMutationDataFetcherSpec.groovy) 2. Live DB tests on endpoints - - In [file servlet endpoint test](../../../../athena-examples/athena-example-books/src/test/groovy/com/qubitpi/athena/example/books/web/endpoints/FileServletSpec.groovy) + - In [file servlet endpoint test](../../../../athena-examples/athena-example-books/src/test/groovy/org/qubitpi/athena/example/books/web/endpoints/FileServletSpec.groovy) and - [meta data servlet endpoint test](../../../../athena-examples/athena-example-books/src/test/groovy/com/qubitpi/athena/example/books/web/endpoints/MetaServletSpec.groovy), - [Flyway migration](../../../../athena-examples/athena-example-books/src/test/groovy/com/qubitpi/athena/example/books/application/SQLDBResourceManager.groovy) + [meta data servlet endpoint test](../../../../athena-examples/athena-example-books/src/test/groovy/org/qubitpi/athena/example/books/web/endpoints/MetaServletSpec.groovy), + [Flyway migration](../../../../athena-examples/athena-example-books/src/test/groovy/org/qubitpi/athena/example/books/application/SQLDBResourceManager.groovy) injects real data into a Derby in-meomroy SQL DB - The Derby data is injected via a shared [DBCP DataSource](#reference---apache-commons-dbcp2) declared in [application BinderFactory](../../../../athena-examples/athena-example-books/src/main/java/org/qubitpi/athena/example/books/application/BooksBinderFactory.java) diff --git a/docs/pages/guide/v1/14-test.md b/docs/pages/guide/v1/14-test.md index 4ee711864..2acff20ee 100644 --- a/docs/pages/guide/v1/14-test.md +++ b/docs/pages/guide/v1/14-test.md @@ -38,7 +38,7 @@ is carried out using Error loading class-diagram.png Each -[`***ServletSpec.groovy`](https://github.com/QubitPi/athena/tree/master/athena-core/src/test/groovy/com/qubitpi/athena/web/endpoints) +[`***ServletSpec.groovy`](https://github.com/QubitPi/athena/tree/master/athena-core/src/test/groovy/org/qubitpi/athena/web/endpoints) follows the following pattern to setup, run, and shutdown tests: ### 1. Initialize ApplicationState diff --git a/pom.xml b/pom.xml index 458da8d80..20178b3f1 100644 --- a/pom.xml +++ b/pom.xml @@ -36,10 +36,13 @@ + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + - github - GitHub QubitPi Apache Maven Packages - https://maven.pkg.github.com/QubitPi/athena + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ @@ -588,6 +591,18 @@ org.apache.maven.plugins maven-failsafe-plugin + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ossrh + https://s01.oss.sonatype.org/ + true + +