diff --git a/.github/workflows/hotfix-release.yml b/.github/workflows/hotfix-release.yml index 072da2a7..2bace0fc 100644 --- a/.github/workflows/hotfix-release.yml +++ b/.github/workflows/hotfix-release.yml @@ -27,6 +27,22 @@ on: version: description: 'Version' required: true + release_docker_image: + description: 'Should we release the Docker image?' + required: true + default: 'yes' + type: choice + options: + - 'yes' + - 'no' + release_edc: + description: 'Should we release the EDC extension?' + required: true + default: 'yes' + type: choice + options: + - 'yes' + - 'no' jobs: build: @@ -59,8 +75,16 @@ jobs: git tag v${{ inputs.version }} git push origin v${{ inputs.version }} call-image-release: + if: ${{ inputs.release_docker_image == 'yes' }} uses: ./.github/workflows/publish-image-registry.yml needs: build secrets: inherit with: tag: v${{ inputs.version }} + call-edc-maven-central-publish: + if: ${{ inputs.release_edc == 'yes' }} + uses: ./.github/workflows/publish-edc-ext-to-maven-central.yml + needs: build + secrets: inherit + with: + tag: v${{ inputs.version }} diff --git a/.github/workflows/publish-edc-ext-to-maven-central.yml b/.github/workflows/publish-edc-ext-to-maven-central.yml new file mode 100644 index 00000000..8f4e5bd3 --- /dev/null +++ b/.github/workflows/publish-edc-ext-to-maven-central.yml @@ -0,0 +1,76 @@ +################################################################################ +# Copyright (c) 2024 Robert Bosch Manufacturing Solutions GmbH and others +# Copyright (c) 2024 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 EDC extension to Maven Central + +on: + workflow_dispatch: + inputs: + tag: + type: string + description: The name of the tag from which we would like to build an artifact + required: true + +jobs: + maven-release: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout if workflow_dispatch + if: ${{ github.event_name == 'workflow_dispatch' }} + uses: actions/checkout@v3 + with: + ref: ${{ inputs.tag }} + - name: setup-java + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 17 + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + - name: Setup Maven Action + uses: s4u/setup-maven-action@v1.7.0 + with: + java-version: 17 + - name: List Keys (set up GPG) + 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 + - name: Publish to the Maven Central Repository + shell: bash + run: | + mvn clean verify nexus-staging:deploy -Dgpg.passphrase=${{ secrets.ORG_GPG_PASSPHRASE }} -f libraries/edc-extension/pom.xml -P release-to-central + env: + MAVEN_USERNAME: ${{ secrets.ORG_OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e18e2678..345e401f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,22 @@ on: version: description: 'Version' required: true + release_docker_image: + description: 'Should we release the Docker image?' + required: true + default: 'yes' + type: choice + options: + - 'yes' + - 'no' + release_edc: + description: 'Should we release the EDC extension?' + required: true + default: 'yes' + type: choice + options: + - 'yes' + - 'no' jobs: build: @@ -64,8 +80,16 @@ jobs: git push origin release git push origin v${{ inputs.version }} call-image-release: + if: ${{ inputs.release_docker_image == 'yes' }} uses: ./.github/workflows/publish-image-registry.yml needs: build secrets: inherit + with: + tag: v${{ inputs.version }} + call-edc-maven-central-publish: + if: ${{ inputs.release_edc == 'yes' }} + uses: ./.github/workflows/publish-edc-ext-to-maven-central.yml + needs: build + secrets: inherit with: tag: v${{ inputs.version }} \ No newline at end of file diff --git a/libraries/edc-extension/pom.xml b/libraries/edc-extension/pom.xml index 83ce97f5..1ecbded0 100644 --- a/libraries/edc-extension/pom.xml +++ b/libraries/edc-extension/pom.xml @@ -37,16 +37,22 @@ jar - ${organization} - ${url} + Tractus-X project + https://projects.eclipse.org/projects/automotive.tractusx + + https://github.com/eclipse-tractusx/sldt-digital-twin-registry/ + scm:git:https://github.com/eclipse-tractusx/sldt-digital-twin-registry.git + scm:git:https://github.com/eclipse-tractusx/sldt-digital-twin-registry.git + + - ${licence_name} - ${licence_url} - ${licence_distribution} - ${licence_comments} + Apache License, Version 2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + repo + An Eclipse Project @@ -111,26 +117,74 @@ + + + ${project.parent.basedir} + + LICENSE + NOTICE.md + DEPENDENCIES + + META-INF/ + + + ${project.basedir}/src/main/resources + + org.apache.maven.plugins maven-compiler-plugin - io.github.git-commit-id git-commit-id-maven-plugin - org.apache.maven.plugins maven-surefire-plugin - org.apache.maven.plugins - maven-deploy-plugin + maven-javadoc-plugin + + + org.apache.maven.plugins + maven-source-plugin + + + + release-to-central + + false + + + + + org.apache.maven.plugins + maven-gpg-plugin + + + org.sonatype.plugins + nexus-staging-maven-plugin + + + + + + + + + ossrh + https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + diff --git a/pom.xml b/pom.xml index 1327b9bd..93e69205 100644 --- a/pom.xml +++ b/pom.xml @@ -438,15 +438,67 @@ + + org.apache.maven.plugins + maven-javadoc-plugin + 3.6.3 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.2.2 + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + true + + ossrh + https://oss.sonatype.org/ + + false + + org.apache.maven.plugins maven-deploy-plugin 2.8.2 - org.openapitools - openapi-generator-maven-plugin - 6.2.1 + org.openapitools + openapi-generator-maven-plugin + 6.2.1