From ba007c03fdb368f1ce293e16bb9748a50a221c10 Mon Sep 17 00:00:00 2001 From: He Wang Date: Fri, 14 Jan 2022 20:50:51 +0800 Subject: [PATCH] add publish snapshot action (#25) --- .github/workflows/maven_build.yml | 5 +--- .github/workflows/maven_publish_snapshot.yml | 28 ++++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/maven_publish_snapshot.yml diff --git a/.github/workflows/maven_build.yml b/.github/workflows/maven_build.yml index 677c17d..fa919f1 100644 --- a/.github/workflows/maven_build.yml +++ b/.github/workflows/maven_build.yml @@ -1,9 +1,6 @@ name: Maven Build on: - push: - branches: - - master pull_request: branches: - master @@ -20,4 +17,4 @@ jobs: java-version: '8' distribution: 'zulu' - name: Build with Maven - run: mvn clean package + run: mvn clean install diff --git a/.github/workflows/maven_publish_snapshot.yml b/.github/workflows/maven_publish_snapshot.yml new file mode 100644 index 0000000..417e944 --- /dev/null +++ b/.github/workflows/maven_publish_snapshot.yml @@ -0,0 +1,28 @@ +name: Maven Publish Snapshot + +on: + push: + branches: + - master + +jobs: + publish-snapshot: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Apache Maven Central + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'zulu' + server-id: sonatype-nexus-snapshots + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-passphrase: GPG_PASSPHRASE + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + - name: Publish to Apache Maven Central + run: mvn clean verify gpg:sign install:install deploy:deploy + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} -- GitLab