|
| 1 | +name: Deploy Release to Maven Central |
| 2 | +description: "Deploys released artifacts to Maven Central repository." |
| 3 | + |
| 4 | +inputs: |
| 5 | + user: |
| 6 | + description: "The user used for the upload (technical user for maven central upload)" |
| 7 | + required: true |
| 8 | + password: |
| 9 | + description: "The password used for the upload (technical user for maven central upload)" |
| 10 | + required: true |
| 11 | + profile: |
| 12 | + description: "The profile id" |
| 13 | + required: true |
| 14 | + pgp-pub-key: |
| 15 | + description: "The public pgp key ID" |
| 16 | + required: true |
| 17 | + pgp-private-key: |
| 18 | + description: "The private pgp key" |
| 19 | + required: true |
| 20 | + pgp-passphrase: |
| 21 | + description: "The passphrase for pgp" |
| 22 | + required: true |
| 23 | + revision: |
| 24 | + description: "The revision of cds-feature-auditlog-ng" |
| 25 | + required: true |
| 26 | + maven-version: |
| 27 | + description: "The Maven version the build shall run with." |
| 28 | + required: true |
| 29 | + |
| 30 | +runs: |
| 31 | + using: composite |
| 32 | + steps: |
| 33 | + - name: Echo Inputs |
| 34 | + run: | |
| 35 | + echo "user: ${{ inputs.user }}" |
| 36 | + echo "profile: ${{ inputs.profile }}" |
| 37 | + echo "revision: ${{ inputs.revision }}" |
| 38 | + shell: bash |
| 39 | + |
| 40 | + - name: Set up Java |
| 41 | + uses: actions/setup-java@v4 |
| 42 | + with: |
| 43 | + distribution: sapmachine |
| 44 | + java-version: '17' |
| 45 | + cache: maven |
| 46 | + server-id: ossrh |
| 47 | + server-username: MAVEN_CENTRAL_USER |
| 48 | + server-password: MAVEN_CENTRAL_PASSWORD |
| 49 | + |
| 50 | + - name: Set up Maven ${{ inputs.maven-version }} |
| 51 | + uses: stCarolas/setup-maven@v5 |
| 52 | + with: |
| 53 | + maven-version: ${{ inputs.maven-version }} |
| 54 | + |
| 55 | + - name: Import GPG Key |
| 56 | + run: | |
| 57 | + echo "${{ inputs.pgp-private-key }}" | gpg --batch --passphrase "$PASSPHRASE" --import |
| 58 | + shell: bash |
| 59 | + env: |
| 60 | + PASSPHRASE: ${{ inputs.pgp-passphrase }} |
| 61 | + |
| 62 | + - name: Deploy Locally |
| 63 | + run: > |
| 64 | + mvn -B -ntp -fae --show-version |
| 65 | + -Durl=file:./temp_local_repo |
| 66 | + -Dmaven.install.skip=true |
| 67 | + -Dmaven.test.skip=true |
| 68 | + -Dgpg.passphrase="$GPG_PASSPHRASE" |
| 69 | + -Dgpg.keyname="$GPG_PUB_KEY" |
| 70 | + -Drevision="${{ inputs.revision }}" |
| 71 | + deploy |
| 72 | + working-directory: ./deploy-oss |
| 73 | + shell: bash |
| 74 | + env: |
| 75 | + MAVEN_CENTRAL_USER: ${{ inputs.user }} |
| 76 | + MAVEN_CENTRAL_PASSWORD: ${{ inputs.password }} |
| 77 | + GPG_PASSPHRASE: ${{ inputs.pgp-passphrase }} |
| 78 | + GPG_PUB_KEY: ${{ inputs.pgp-pub-key }} |
| 79 | + |
| 80 | + - name: Deploy Staging |
| 81 | + run: > |
| 82 | + mvn -B -ntp -fae --show-version |
| 83 | + org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:deploy-staged-repository |
| 84 | + -DserverId=ossrh |
| 85 | + -DnexusUrl=https://oss.sonatype.org |
| 86 | + -DrepositoryDirectory=./temp_local_repo |
| 87 | + -DstagingProfileId="$MAVEN_CENTRAL_PROFILE_ID" |
| 88 | + -Drevision="${{ inputs.revision }}" |
| 89 | + working-directory: ./deploy-oss |
| 90 | + shell: bash |
| 91 | + env: |
| 92 | + MAVEN_CENTRAL_USER: ${{ inputs.user }} |
| 93 | + MAVEN_CENTRAL_PASSWORD: ${{ inputs.password }} |
| 94 | + MAVEN_CENTRAL_PROFILE_ID: ${{ inputs.profile }} |
0 commit comments