From 8edc59b041f69dda4169788665801cd24eb5f1dc Mon Sep 17 00:00:00 2001 From: "yadong.zhang" Date: Wed, 28 Apr 2021 15:10:01 +0800 Subject: [PATCH] Create maven-publish.yml --- maven-publish.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 maven-publish.yml diff --git a/maven-publish.yml b/maven-publish.yml new file mode 100644 index 0000000..c4d489f --- /dev/null +++ b/maven-publish.yml @@ -0,0 +1,39 @@ +# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created +# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path + +name: Publish Snapshot + +on: + workflow_dispatch: + push: + branches: + - dev + pull_request: + branches: + - dev + +jobs: + publish: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + # 安装JDK环境 + - name: Set up JDK 1.8 + uses: actions/setup-java@v2 + with: + java-version: 1.8 + server-id: sonatype-nexus-snapshots # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + + - name: Build with Maven + run: mvn -B package --file pom.xml + + - name: Publish to GitHub Packages Apache Maven + run: mvn --batch-mode deploy + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}