diff --git a/.github/workflows/publish-snapshot-maven.yaml b/.github/workflows/publish-snapshot-maven.yaml new file mode 100644 index 00000000..76c99009 --- /dev/null +++ b/.github/workflows/publish-snapshot-maven.yaml @@ -0,0 +1,96 @@ +################################################################################ +# Copyright (c) 2021,2023 Contributors to the Eclipse Foundation +# +# See the NOTICE file(s) distributed with this work for additional +# information regarding copyright ownership. +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 +################################################################################ +--- +name: Publish SNAPSHOT version + +on: + workflow_dispatch: +jobs: + publish-maven: + runs-on: ubuntu-latest + steps: + - name: Checkout branch + uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v1 + with: + java-version: 17 + distribution: temurin + + # use the default GitHub runner user for the next steps + # this is needed during deploy, for pushing a tag + - name: Configure Git User + uses: fregante/setup-git-user@v2 + + # this is necessary because it creates gpg.conf, etc. + - name: List Keys + shell: bash + run: | + gpg -K --keyid-format=long + + - name: Import GPG Private Key + shell: bash + run: | + echo "use-agent" >> ~/.gnupg/gpg.conf + echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf + echo -e "${{ secrets.ORG_GPG_PRIVATE_KEY }}" | gpg --import --batch + for fpr in $(gpg --list-keys --with-colons | awk -F: '/fpr:/ {print $10}' | sort -u); + do + echo -e "5\\ny\\n" | gpg --batch --command-fd 0 --expert --edit-key $fpr trust; + done + + # Environment variables used in settings.xml and pom.xml + - name: Publish to Maven + shell: bash + env: + MAVEN_USERNAME: ${{ secrets.ORG_OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }} + GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }} + # command summary + # -B/--batch-mode: only display progress and errors + # -U: update snapshot-releases + # -Pci-cd: apply the ci-cd profile (in pom.xml) + # -s settings.xml: use custom settings file + run: | + if [[ $(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout) == *SNAPSHOT ]]; then + ./mvnw -B -U \ + -Pci-cd \ + -s settings.xml \ + deploy + fi + + # artifact_name is cx-ssi-lib and the version should be the *-SNAPSHOT + # In the next step we'll use the releaseVersion to finalize the upload + - name: Get generated artifact name + shell: bash + run: | + echo "artifact_name=$(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.artifactId -q -DforceStdout)" >> "$GITHUB_ENV" + echo "artifact_version=$(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout)" >> "$GITHUB_ENV" + + # Use the generated name to supply the input 'path' for the upload, + # but upload the final + # Example: + # input: cx-ssi-lib-0.0.1-SNAPSHOT.jar + # output: cx-ssi-lib-0.0.1.jar + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ env.artifact_name }}-${{ inputs.releaseVersion }} + path: ./target/${{ env.artifact_name }}-${{ env.artifact_version }}.jar diff --git a/pom.xml b/pom.xml index 201593dc..f5935180 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ SPDX-License-Identifier: Apache-2.0 4.0.0 org.eclipse.tractusx.ssi cx-ssi-lib - 0.0.18-SNAPSHOT + 0.0.17-SNAPSHOT jar @@ -234,19 +234,29 @@ SPDX-License-Identifier: Apache-2.0 + - org.apache.maven.plugins - maven-javadoc-plugin - 3.6.0 - - - attach-javadocs - compile - - jar - - - + org.apache.maven.plugins + maven-release-plugin + 3.0.1 + + @{project.version} + true + false + ci-cd + deploy + + + + default + + perform + + + org.eclipse.dash @@ -371,30 +381,6 @@ SPDX-License-Identifier: Apache-2.0 ${env.AUTO_RELEASE_AFTER_CLOSE} - - - org.apache.maven.plugins - maven-release-plugin - 3.0.1 - - @{project.version} - true - false - ci-cd - deploy - - - - default - - perform - - - - org.apache.maven.plugins maven-gpg-plugin