Skip to content

Commit d349205

Browse files
authored
Merge pull request #346 from eclipse-esmf/341-change-deployment-to-maven-central
Update publishing to Maven Central
2 parents d9fbb5e + bde22fb commit d349205

File tree

3 files changed

+60
-24
lines changed

3 files changed

+60
-24
lines changed

.github/workflows/release-artifact.yml

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,69 @@ jobs:
1111

1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v3
14+
uses: actions/checkout@v4
1515

1616
- name: Set up JDK 11
17-
uses: actions/setup-java@v3
17+
uses: actions/setup-java@v4
1818
with:
19-
distribution: 'adopt'
19+
distribution: 'temurin'
2020
java-version: '11'
21-
server-id: ossrh
22-
server-username: OSSRH_USERNAME
23-
server-password: OSSRH_TOKEN
21+
server-id: central
22+
server-username: CENTRAL_SONATYPE_TOKEN_USERNAME
23+
server-password: CENTRAL_SONATYPE_TOKEN_PASSWORD
2424
gpg-private-key: ${{ secrets.PGP_KEY }}
2525
gpg-passphrase: PGP_KEY_PASSWORD
26-
overwrite-settings: true
26+
overwrite-settings: false
2727

2828
- name: Set release version in antora.yml
2929
uses: mikefarah/yq@master
3030
with:
3131
cmd: yq eval -i '.version = "${{ github.event.inputs.release_version }}"' documentation/antora.yml
3232

33-
- name: Build SAMM artifact and release to OSSRH
33+
- name: Build SAMM artifact and create Maven Central bundle
3434
run: |
3535
set -x
36+
37+
export MAVEN_OPTS="-Xmx4096m"
38+
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
39+
release_version=${{ github.event.inputs.release_version }}
40+
3641
rm -rf ~/.m2/repository/org/eclipse/esmf
37-
./mvnw -B versions:set -DnewVersion=${{ github.event.inputs.release_version }}
42+
./mvnw -B versions:set -DnewVersion=${ release_version }
3843
./mvnw -B versions:commit
3944
# Since the meta model project itself does not inherit from the parent, we must set its version separately
40-
./mvnw -B versions:set -DnewVersion=${{ github.event.inputs.release_version }} -pl esmf-semantic-aspect-meta-model
45+
./mvnw -B versions:set -DnewVersion=${ release_version } -pl esmf-semantic-aspect-meta-model
4146
./mvnw -B versions:commit -pl esmf-semantic-aspect-meta-model
4247
./mvnw -B clean generate-resources -pl documentation -Pantora
4348
./mvnw -B -U clean install -pl esmf-samm-build-plugin
44-
./mvnw -B -U clean deploy -pl esmf-semantic-aspect-meta-model -Psign,release-build
49+
./mvnw -B -U clean deploy -pl esmf-semantic-aspect-meta-model -Psign,release-build -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
50+
51+
echo "Contents of target/central-staging:"
52+
ls -lR target/central-staging
53+
54+
pushd target/central-staging
55+
zip -r -9 ../central-bundle.zip .
56+
popd
57+
4558
cd build/
46-
mv site SAMM-${{ github.event.inputs.release_version }}
47-
zip -r ../SAMM-${{ github.event.inputs.release_version }}-specification.zip SAMM-${{ github.event.inputs.release_version }}
59+
mv site SAMM-${ release_version }
60+
zip -r ../SAMM-${ release_version }-specification.zip SAMM-${ release_version }
4861
env:
49-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
50-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
5162
PGP_KEY_PASSWORD: ${{ secrets.PGP_KEY_PASSWORD }}
5263

53-
# If the deployment to OSSRH went through, the following steps will
64+
- name: Release to Maven Central
65+
if: ${{ !contains( github.event.inputs.release_version, '-M' ) }}
66+
run: |
67+
token_header=$(printf "$CENTRAL_USERNAME:$CENTRAL_TOKEN" | base64)
68+
curl --request POST \
69+
--header "Authorization: Bearer $token_header" \
70+
71+
https://central.sonatype.com/api/v1/publisher/upload
72+
env:
73+
CENTRAL_USERNAME: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}
74+
CENTRAL_TOKEN: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}
75+
76+
# If the deployment to Maven Central went through, the following steps will
5477
# - Commit updated version to release branch
5578
# - Create Github release
5679

documentation/pom.xml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@
6868
</configuration>
6969
</plugin>
7070

71-
<plugin>
72-
<groupId>org.sonatype.plugins</groupId>
73-
<artifactId>nexus-staging-maven-plugin</artifactId>
74-
<configuration>
75-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
76-
</configuration>
77-
</plugin>
78-
7971
<plugin>
8072
<groupId>org.apache.maven.plugins</groupId>
8173
<artifactId>maven-gpg-plugin</artifactId>

pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,27 @@
6363
</execution>
6464
</executions>
6565
</plugin>
66+
67+
<plugin>
68+
<groupId>org.apache.maven.plugins</groupId>
69+
<artifactId>maven-deploy-plugin</artifactId>
70+
<version>${maven-deploy-plugin-version}</version>
71+
<configuration>
72+
<skip>true</skip>
73+
</configuration>
74+
</plugin>
75+
76+
<plugin>
77+
<groupId>org.sonatype.central</groupId>
78+
<artifactId>central-publishing-maven-plugin</artifactId>
79+
<extensions>true</extensions>
80+
<configuration>
81+
<publishingServerId>central</publishingServerId>
82+
<autoPublish>false</autoPublish>
83+
<skipPublishing>true</skipPublishing>
84+
<outputFilename>central-bundle.zip</outputFilename>
85+
</configuration>
86+
</plugin>
6687
</plugins>
6788
</build>
6889
</project>

0 commit comments

Comments
 (0)