diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 25b057b69..79bb8bf40 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,21 @@ jobs: run: echo $(git diff -- sysml.library/.index.json) | grep -e '^$' || (echo "Library index in the git repository is not up to date. Please re-generate it and push changes to the repository."; exit 1) - name: Publish to Github Packages if: github.event_name != 'pull_request' - run: ./mvnw -B deploy -DskipTests=true + run: ./mvnw -B -s .mvn/settings.xml deploy -DskipTests=true env: GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password + # Snapshots reuse the central-publish profile, which signs artifacts via maven-gpg-plugin, + # so the runner needs the private key before deploy. + - name: Import GPG key for Maven Central snapshots + if: ${{ github.event_name != 'pull_request' && secrets.CENTRAL_TOKEN_USERNAME != '' && secrets.CENTRAL_TOKEN_PASSWORD != '' && secrets.MAVEN_GPG_PRIVATE_KEY != '' && secrets.MAVEN_GPG_PASSPHRASE != '' }} + env: + MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + run: | + printf '%s' "${MAVEN_GPG_PRIVATE_KEY}" | gpg --batch --import + - name: Publish org.omg.sysml.model snapshot to Maven Central + if: ${{ github.event_name != 'pull_request' && secrets.CENTRAL_TOKEN_USERNAME != '' && secrets.CENTRAL_TOKEN_PASSWORD != '' && secrets.MAVEN_GPG_PRIVATE_KEY != '' && secrets.MAVEN_GPG_PASSPHRASE != '' }} + run: ./mvnw -B -s .mvn/settings.xml -f org.omg.sysml.model/pom.xml deploy -Pcentral-publish,central-snapshot -DskipTests=true -Dgpg.passphrase=${MAVEN_GPG_PASSPHRASE} + env: + CENTRAL_TOKEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }} + CENTRAL_TOKEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 9a4d08ee5..85c0efc30 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -28,9 +28,24 @@ jobs: - name: Remove -snapshot from version run: ./mvnw -B versions:set -DremoveSnapshot=true - name: Publish to Github Packages - run: ./mvnw -B deploy -DskipTests=true + run: ./mvnw -B -s .mvn/settings.xml deploy -DskipTests=true env: GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password + # Releases reuse the central-publish profile, which signs artifacts via maven-gpg-plugin, + # so the runner needs the private key before deploy. + - name: Import GPG key for Maven Central release + if: ${{ secrets.CENTRAL_TOKEN_USERNAME != '' && secrets.CENTRAL_TOKEN_PASSWORD != '' && secrets.MAVEN_GPG_PRIVATE_KEY != '' && secrets.MAVEN_GPG_PASSPHRASE != '' }} + env: + MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + run: | + printf '%s' "${MAVEN_GPG_PRIVATE_KEY}" | gpg --batch --import + - name: Publish org.omg.sysml.model release to Maven Central + if: ${{ secrets.CENTRAL_TOKEN_USERNAME != '' && secrets.CENTRAL_TOKEN_PASSWORD != '' && secrets.MAVEN_GPG_PRIVATE_KEY != '' && secrets.MAVEN_GPG_PASSPHRASE != '' }} + run: ./mvnw -B -s .mvn/settings.xml -f org.omg.sysml.model/pom.xml deploy -Pcentral-publish,central-release -DskipTests=true -Dgpg.passphrase=${MAVEN_GPG_PASSPHRASE} + env: + CENTRAL_TOKEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }} + CENTRAL_TOKEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} - name: Upload SysML Library .kpar files uses: actions/upload-artifact@v5 with: diff --git a/.mvn/settings.xml b/.mvn/settings.xml new file mode 100644 index 000000000..50572f923 --- /dev/null +++ b/.mvn/settings.xml @@ -0,0 +1,53 @@ + + + + + github + ${env.GITHUB_ACTOR} + ${env.GITHUB_TOKEN} + + + central + ${env.CENTRAL_TOKEN_USERNAME} + ${env.CENTRAL_TOKEN_PASSWORD} + + + + + + default-repositories + + + central + Maven Central + https://repo.maven.apache.org/maven2 + + true + + + false + + + + + + central + Maven Central + https://repo.maven.apache.org/maven2 + + true + + + false + + + + + + + + default-repositories + + diff --git a/org.omg.sysml.model/pom.xml b/org.omg.sysml.model/pom.xml index 0a555988d..8a8c33b74 100644 --- a/org.omg.sysml.model/pom.xml +++ b/org.omg.sysml.model/pom.xml @@ -13,9 +13,39 @@ org.omg.sysml.model jar + OMG SysML Model + EMF-based SysML v2 model artifacts for the SysML v2 Pilot Implementation. + https://github.com/Systems-Modeling/SysML-v2-Pilot-Implementation + + + + Eclipse Public License 2.0 + https://www.eclipse.org/legal/epl-2.0/ + repo + + + + + + Systems Modeling Team + Object Management Group + https://www.omg.org/ + + + + + scm:git:https://github.com/Systems-Modeling/SysML-v2-Pilot-Implementation.git + scm:git:https://github.com/Systems-Modeling/SysML-v2-Pilot-Implementation.git + https://github.com/Systems-Modeling/SysML-v2-Pilot-Implementation + + UTF-8 UTF-8 + 3.2.7 + 3.11.2 + 3.3.1 + 0.9.0 @@ -30,4 +60,102 @@ 2.42.0 + + + + + central-publish + + + + + org.apache.maven.plugins + maven-source-plugin + ${maven-source-plugin.version} + + + attach-sources + + jar-no-fork + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + none + false + ${java.version} + + + + attach-javadocs + + jar + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + ${maven-gpg-plugin.version} + + + sign-artifacts + verify + + sign + + + + + --pinentry-mode + loopback + + + + + + + + + + + central-snapshot + + + central + Sonatype Central Snapshots + https://central.sonatype.com/repository/maven-snapshots/ + + + + + + central-release + + + + + org.sonatype.central + central-publishing-maven-plugin + ${central-publishing-maven-plugin.version} + true + + central + true + published + ${project.groupId}:${project.artifactId}:${project.version} + + + + + +