|
| 1 | +name: Maven Release |
| 2 | +description: "Deploys a Maven package 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 sdm" |
| 25 | + required: true |
| 26 | + |
| 27 | +runs: |
| 28 | + using: composite |
| 29 | + steps: |
| 30 | + - name: "Echo Inputs" |
| 31 | + run: | |
| 32 | + echo "user: ${{ inputs.user }}" |
| 33 | + echo "profile: ${{ inputs.profile }}" |
| 34 | + shell: bash |
| 35 | + |
| 36 | + - name: "Setup Java" |
| 37 | + uses: actions/setup-java@v4 |
| 38 | + with: |
| 39 | + distribution: 'sapmachine' |
| 40 | + java-version: '17' |
| 41 | + cache: maven |
| 42 | + server-id: central |
| 43 | + server-username: MAVEN_CENTRAL_USER |
| 44 | + server-password: MAVEN_CENTRAL_PASSWORD |
| 45 | + |
| 46 | + - name: "Import GPG Key" |
| 47 | + run: | |
| 48 | + echo "${{ inputs.pgp-private-key }}" | gpg --batch --passphrase "$PASSPHRASE" --import |
| 49 | + shell: bash |
| 50 | + env: |
| 51 | + PASSPHRASE: ${{ inputs.pgp-passphrase }} |
| 52 | + |
| 53 | + - name: "Ensure Local Repo Directory" |
| 54 | + run: | |
| 55 | + mkdir -p ./deploy-oss/temp_local_repo |
| 56 | + ls -al ./deploy-oss |
| 57 | + shell: bash |
| 58 | + |
| 59 | + - name: Deploy to Maven Central |
| 60 | + run: > |
| 61 | + mvn -B -ntp --show-version |
| 62 | + -Dmaven.install.skip=true |
| 63 | + -Dmaven.test.skip=true |
| 64 | + -Dgpg.passphrase="$GPG_PASSPHRASE" |
| 65 | + -Dgpg.keyname="$GPG_PUB_KEY" |
| 66 | + clean deploy -P deploy-release |
| 67 | + shell: bash |
| 68 | + env: |
| 69 | + MAVEN_CENTRAL_USER: ${{ inputs.user }} |
| 70 | + MAVEN_CENTRAL_PASSWORD: ${{ inputs.password }} |
| 71 | + GPG_PASSPHRASE: ${{ inputs.pgp-passphrase }} |
| 72 | + GPG_PUB_KEY: ${{ inputs.pgp-pub-key }} |
| 73 | + |
| 74 | + # - name: "Deploy Locally" |
| 75 | + # run: | |
| 76 | + # echo "Deploying artifacts locally..." |
| 77 | + # mvn --batch-mode --no-transfer-progress --fail-at-end --show-version \ |
| 78 | + # -Durl=file:./temp_local_repo \ |
| 79 | + # -Dmaven.install.skip=true \ |
| 80 | + # -Dmaven.test.skip=true \ |
| 81 | + # -Dgpg.passphrase="$GPG_PASSPHRASE" \ |
| 82 | + # -Dgpg.keyname="$GPG_PUB_KEY" \ |
| 83 | + # -Drevision="${{ inputs.revision }}" \ |
| 84 | + # deploy |
| 85 | + # working-directory: ./deploy-oss |
| 86 | + # shell: bash |
| 87 | + # env: |
| 88 | + # MAVEN_CENTRAL_USER: ${{ inputs.user }} |
| 89 | + # MAVEN_CENTRAL_PASSWORD: ${{ inputs.password }} |
| 90 | + # GPG_PASSPHRASE: ${{ inputs.pgp-passphrase }} |
| 91 | + # GPG_PUB_KEY: ${{ inputs.pgp-pub-key }} |
| 92 | + |
| 93 | + # - name: "List Contents of Local Repo" |
| 94 | + # run: | |
| 95 | + # echo "Contents of temp_local_repo:" |
| 96 | + # ls -al ./deploy-oss/temp_local_repo |
| 97 | + # shell: bash |
| 98 | + |
| 99 | + # - name: "Deploy Staging" |
| 100 | + # run: | |
| 101 | + # mvn --batch-mode --no-transfer-progress --fail-at-end --show-version \ |
| 102 | + # org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:deploy-staged-repository \ |
| 103 | + # -DserverId=ossrh \ |
| 104 | + # -DnexusUrl=https://oss.sonatype.org \ |
| 105 | + # -DrepositoryDirectory=./temp_local_repo \ |
| 106 | + # -DstagingProfileId="$MAVEN_CENTRAL_PROFILE_ID" \ |
| 107 | + # -Drevision="${{ inputs.revision }}" |
| 108 | + # working-directory: ./deploy-oss |
| 109 | + # shell: bash |
| 110 | + # env: |
| 111 | + # MAVEN_CENTRAL_USER: ${{ inputs.user }} |
| 112 | + # MAVEN_CENTRAL_PASSWORD: ${{ inputs.password }} |
| 113 | + # MAVEN_CENTRAL_PROFILE_ID: ${{ inputs.profile }} |
0 commit comments