diff --git a/.github/workflows/build-and-release-package.yml b/.github/workflows/build-and-release-package.yml new file mode 100644 index 0000000..8d63bc3 --- /dev/null +++ b/.github/workflows/build-and-release-package.yml @@ -0,0 +1,32 @@ +name: "build-and-release-package" + +on: "workflow_dispatch" + +concurrency: "${{github.workflow}}-${{github.ref}}" + +jobs: + build-package: + runs-on: "ubuntu-latest" + permissions: + packages: "write" + steps: + - uses: "actions/checkout@v3" + with: + submodules: "recursive" + + - uses: "actions/setup-java@v4" + with: + java-version: "11" + distribution: "adopt" + server-id: "ossrh" + server-username: "MAVEN_USERNAME" + server-password: "MAVEN_PASSWORD" + gpg-private-key: "${{secrets.GPG_PRIVATE_KEY}}" + gpg-passphrase: "MAVEN_GPG_PASSPHRASE" + + - name: "Build package, run tests, and deploy to GitHub" + run: "mvn --batch-mode deploy -Pmaven_release" + env: + MAVEN_USERNAME: "${{secrets.OSSRH_USERNAME}}" + MAVEN_PASSWORD: "${{secrets.OSSRH_TOKEN}}" + MAVEN_GPG_PASSPHRASE: "${{secrets.GPG_PASSPHRASE}}" diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml new file mode 100644 index 0000000..2d189bb --- /dev/null +++ b/.github/workflows/build-package.yml @@ -0,0 +1,38 @@ +name: "build-package" + +on: + push: + paths: + - ".github/workflows/build-package.yml" + - "pom.xml" + - "src/**" + workflow_dispatch: + +concurrency: + group: "${{github.workflow}}-${{github.ref}}" + cancel-in-progress: true + +jobs: + build-package: + runs-on: "ubuntu-latest" + permissions: + packages: "write" + steps: + - uses: "actions/checkout@v3" + with: + submodules: "recursive" + + - uses: "actions/setup-java@v4" + with: + java-version: "11" + distribution: "adopt" + server-id: "github" + + - name: "Build package and run tests" + run: "mvn --batch-mode test" + + - if: "${{github.event_name != 'pull_request' && github.ref == 'refs/heads/main'}}" + name: "Deploy to GitHub" + env: + GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}" + run: "mvn --batch-mode deploy -DskipTests -Pgithub_release" diff --git a/pom.xml b/pom.xml index 282d786..fb11b85 100644 --- a/pom.xml +++ b/pom.xml @@ -140,6 +140,11 @@ exec-maven-plugin 3.1.1 + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + @@ -182,4 +187,66 @@ + + + + github_release + + + github + GitHub Packages + https://maven.pkg.github.com/y-scope/logback-appenders + + + + + + maven_release + + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + + + + --pinentry-mode + loopback + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + true + + ossrh + https://s01.oss.sonatype.org/ + true + + + + + +