# 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://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven name: "Deploy & Publish" on: # 支持手动触发构建 workflow_dispatch: release: # 创建release的时候触发 types: [ published ] jobs: gh-deploy: name: "Deploy Project (GitHub)" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: "Set up JDK" uses: actions/setup-java@v2 with: java-version: '11' distribution: 'adopt' # cache: maven # Say 4uck u to github cache services. server-id: github server-username: MAVEN_USERNAME server-password: MAVEN_TOKEN gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - name: "Maven Deploy" run: mvn -B -Pgithub deploy --file pom.xml -DskipTests env: MAVEN_USERNAME: ${{ github.repository_owner }} MAVEN_TOKEN: ${{secrets.GITHUB_TOKEN}} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} central-deploy: name: "Deploy Project (Central)" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: "Set up JDK" uses: actions/setup-java@v2 with: java-version: '11' distribution: 'adopt' # cache: maven # Say 4uck u to github cache services. server-id: ossrh server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase - name: "Central Deploy" run: mvn -B -Possrh deploy --file pom.xml -DskipTests env: MAVEN_USERNAME: ${{ secrets.OSSRH_USER }} MAVEN_PASSWORD: ${{ secrets.OSSRH_PASS }} MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}