From 9ece64e18baa31630d314360c36025bbdd4ab3e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E9=A9=AC=E5=93=A5=EF=BC=88mercyblitz=EF=BC=89?= Date: Sat, 17 Aug 2024 22:56:40 +0800 Subject: [PATCH] Create maven-publish.yml --- .github/workflows/maven-publish.yml | 46 +++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/maven-publish.yml diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml new file mode 100644 index 0000000..241727b --- /dev/null +++ b/.github/workflows/maven-publish.yml @@ -0,0 +1,46 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Maven Publish + +on: + push: + branches: [ 'release-1.x' ] + workflow_dispatch: + inputs: + revision: + description: 'The version to publish' + required: true + default: '0.0.1-SNAPSHOT' + +jobs: + build: + runs-on: ubuntu-latest + if: ${{ inputs.revision }} + steps: + - name: Checkout Source + uses: actions/checkout@v4 + + - name: Setup Maven Central Repository + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + cache: maven + + - name: Publish package + run: mvn --batch-mode --update-snapshots -Drevision=${{ inputs.revision }} -Dgpg.skip=true -Prelease,ci clean deploy + env: + MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }} + SIGN_KEY_ID: ${{ secrets.OSS_SIGNING_KEY_ID_LONG }} + SIGN_KEY: ${{ secrets.OSS_SIGNING_KEY }} + SIGN_KEY_PASS: ${{ secrets.OSS_SIGNING_PASSWORD }}