Skip to content

Commit 57ef51d

Browse files
authored
Merge pull request #777 from bci-oss/776-fix-release-pipeline
Fix release pipeline
2 parents 600786f + 6f2f068 commit 57ef51d

File tree

3 files changed

+70
-63
lines changed

3 files changed

+70
-63
lines changed

.github/workflows/release-workflow.yml

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ jobs:
4242
exit 1
4343
fi
4444
45-
# The Linux build will upload the local Nexus deployment repository
46-
# (i.e., what will be deployed to OSSRH/Maven Central)
45+
# The Linux build will upload the local Maven Central bundle
46+
# (i.e., what will be deployed to Maven Central)
4747
# and the Linux-specific samm-cli binary to the build artifacts
4848
build-linux:
4949
name: Linux build
@@ -63,16 +63,19 @@ jobs:
6363
with:
6464
distribution: 'temurin'
6565
java-version: '21'
66+
server-id: central
67+
# The following variables are defined in https://github.com/eclipse-esmf/.eclipsefdn/blob/main/otterdog/eclipse-esmf.jsonnet
6668
gpg-private-key: ${{ secrets.PGP_KEY }}
6769
gpg-passphrase: PGP_KEY_PASSWORD
70+
server-username: CENTRAL_SONATYPE_TOKEN_USERNAME
71+
server-password: CENTRAL_SONATYPE_TOKEN_PASSWORD
6872
overwrite-settings: false
6973

7074
- name: Setup JDK
7175
uses: graalvm/setup-graalvm@01ed653ac833fe80569f1ef9f25585ba2811baab # v1.3.3
7276
with:
7377
java-version: '21.0.6'
7478
distribution: 'graalvm'
75-
components: 'native-image,js'
7679
github-token: ${{ secrets.GITHUB_TOKEN }}
7780
native-image-job-reports: 'true'
7881

@@ -89,21 +92,30 @@ jobs:
8992
with:
9093
swap-size-gb: 12
9194

92-
# The Linux build will prepare a local Nexus staging repository
95+
# The Linux build will prepare a Maven Central upload "bundle"
9396
# that includes all .jars except the CLI jar
9497
- name: Build and run tests
9598
run: |
9699
export MAVEN_OPTS="-Xmx4096m"
97100
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
101+
release_version=${{ github.event.inputs.release_version }}
102+
98103
# Required for reactor dependencies
99104
mvn clean install -DskipTests -Dmaven.javadoc.skip=true
100-
mvn versions:set -DnewVersion=${{ github.event.inputs.release_version }}
105+
mvn versions:set -DnewVersion=${release_version}
101106
mvn versions:commit
102-
103-
release_version=${{ github.event.inputs.release_version }}
104107
105-
# Actual build of core SDK
106-
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
108+
# Actual build of core SDK
109+
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean deploy -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 -Psign
110+
111+
# Create Maven Central upload bundle
112+
pushd target/central-staging
113+
echo "Contents of $(pwd):"
114+
ls -lR
115+
rm -rf org/eclipse/esmf/esmf-documentation
116+
zip -r -9 ../../central-bundle.zip .
117+
popd
118+
107119
# Build samm-cli executable jar and run integration tests
108120
unset JAVA_TOOL_OPTIONS
109121
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
@@ -137,6 +149,7 @@ jobs:
137149
with:
138150
name: linux-artifacts
139151
path: |
152+
central-bundle.zip
140153
samm-cli-${{ github.event.inputs.release_version }}-linux-x86_64.tar.gz
141154
samm-cli-${{ github.event.inputs.release_version }}.jar
142155
samm-cli-${{ github.event.inputs.release_version }}-javadoc.jar
@@ -158,9 +171,8 @@ jobs:
158171
with:
159172
java-version: '21.0.6'
160173
distribution: 'graalvm'
161-
components: 'native-image,js'
162174
github-token: ${{ secrets.GITHUB_TOKEN }}
163-
native-image-job-reports: 'true'
175+
native-image-job-reports: 'false'
164176

165177
- name: Cache Maven packages
166178
uses: actions/cache@v4
@@ -189,19 +201,19 @@ jobs:
189201
bundle="samm-bundle-$(date +%s)"
190202
mkdir ${bundle}
191203
curl -Lo jre.tar.gz https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.6%2B7/OpenJDK21U-jre_x64_mac_hotspot_21.0.6_7.tar.gz
192-
tar -xvf jre.tar.gz
204+
tar -xvf jre.tar.gz
193205
cp -r ./jdk-21.0.6+7-jre/Contents/Home ./${bundle}/jre
194206
cp tools/samm-cli/target/samm-cli-${{ github.event.inputs.release_version }}.jar ./${bundle}/
195-
207+
196208
cat <<EOF > ./${bundle}/run.sh
197209
#!/usr/bin/env bash
198-
210+
199211
HERE=\${BASH_SOURCE%/*}
200-
212+
201213
"\$HERE/jre/bin/java" -jar "\$HERE/samm-cli-${{ github.event.inputs.release_version }}.jar" "\$@"
202214
EOF
203-
chmod +x ./${bundle}/run.sh
204-
215+
chmod +x ./${bundle}/run.sh
216+
205217
curl -Lo warp-packer https://github.com/dgiagio/warp/releases/download/v0.3.0/macos-x64.warp-packer
206218
chmod +x warp-packer
207219
./warp-packer --arch macos-x64 --input_dir ${bundle} --exec run.sh --output samm
@@ -233,7 +245,6 @@ jobs:
233245
with:
234246
java-version: '21.0.6'
235247
distribution: 'graalvm'
236-
components: 'native-image,js'
237248
github-token: ${{ secrets.GITHUB_TOKEN }}
238249
native-image-job-reports: 'true'
239250

@@ -299,11 +310,10 @@ jobs:
299310
with:
300311
distribution: 'temurin'
301312
java-version: '21'
302-
server-id: ossrh
313+
server-id: central
314+
# The following variables are defined in https://github.com/eclipse-esmf/.eclipsefdn/blob/main/otterdog/eclipse-esmf.jsonnet
303315
server-username: CENTRAL_SONATYPE_TOKEN_USERNAME
304316
server-password: CENTRAL_SONATYPE_TOKEN_PASSWORD
305-
gpg-private-key: GPG_PRIVATE_KEY
306-
gpg-passphrase: GPG_PASSPHRASE
307317
overwrite-settings: false
308318

309319
# Required to run the mvn:versions, since enforcer plugin
@@ -313,7 +323,6 @@ jobs:
313323
with:
314324
java-version: '21.0.6'
315325
distribution: 'graalvm'
316-
components: 'native-image,js'
317326
github-token: ${{ secrets.GITHUB_TOKEN }}
318327
native-image-job-reports: 'false'
319328

@@ -416,27 +425,17 @@ jobs:
416425
curl -X POST https://ci.eclipse.org/esmf/github-webhook/ -H "Content-Type: application/json" -H "X-GitHub-Event: push" -H "X-Hub-Signature: sha1=${SHA1}" -d "${DATA}"
417426
418427
# Full release: Maven Central
419-
# The (apparently) only way to retrieve the staging profile id
420-
# is the undocumented rc-list-profiles command of the
421-
# nexus-staging-maven-plugin:
422-
# mvn org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:rc-list-profiles -DnexusUrl=https://oss.sonatype.org/ -DserverId=ossrh
423428
- name: Release to Maven Central
424429
if: ${{ !contains( github.event.inputs.release_version, '-M' ) }}
425430
run: |
426-
mvn -B -pl '!org.eclipse.esmf:samm-cli,!org.eclipse.esmf:documentation' clean deploy -Psign
427-
# run: |
428-
# mkdir deploy
429-
# mv nexus-staging deploy
430-
# cd deploy
431-
# mvn org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:deploy-staged-repository \
432-
# -DnexusUrl=https://oss.sonatype.org/ \
433-
# -DserverId=ossrh \
434-
# -DrepositoryDirectory=nexus-staging \
435-
# -DstagingProfileId=7e73217781f2e
431+
token_header=$(printf "$CENTRAL_USERNAME:$CENTRAL_TOKEN" | base64)
432+
curl --request POST \
433+
--header "Authorization: Bearer $token_header" \
434+
435+
https://central.sonatype.com/api/v1/publisher/upload
436436
env:
437437
CENTRAL_USERNAME: ${{ secrets.CENTRAL_SONATYPE_TOKEN_USERNAME }}
438438
CENTRAL_TOKEN: ${{ secrets.CENTRAL_SONATYPE_TOKEN_PASSWORD }}
439-
PGP_KEY_PASSWORD: ${{ secrets.GPG_PRIVATE_KEY }}
440439

441440
# Milestone release: Write settings to deploy to Github repo
442441
- name: Write settings.xml

documentation/pom.xml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,6 @@
100100
</configuration>
101101
</plugin>
102102

103-
<plugin>
104-
<groupId>org.apache.maven.plugins</groupId>
105-
<artifactId>maven-jar-plugin</artifactId>
106-
<executions>
107-
<execution>
108-
<id>default-jar</id>
109-
<phase/>
110-
</execution>
111-
</executions>
112-
</plugin>
113-
114103
<plugin>
115104
<groupId>org.apache.maven.plugins</groupId>
116105
<artifactId>maven-source-plugin</artifactId>
@@ -138,21 +127,6 @@
138127
</executions>
139128
</plugin>
140129

141-
<!-- <plugin>-->
142-
<!-- <groupId>org.sonatype.plugins</groupId>-->
143-
<!-- <artifactId>nexus-staging-maven-plugin</artifactId>-->
144-
<!-- <configuration>-->
145-
<!-- <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>-->
146-
<!-- </configuration>-->
147-
<!-- </plugin>-->
148-
149-
<plugin>
150-
<groupId>org.sonatype.central</groupId>
151-
<artifactId>central-publishing-maven-plugin</artifactId>
152-
<version>0.7.0</version>
153-
<extensions>true</extensions>
154-
</plugin>
155-
156130
<plugin>
157131
<groupId>org.codehaus.mojo</groupId>
158132
<artifactId>build-helper-maven-plugin</artifactId>

pom.xml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@
7878
<relative-native-config-path>core/esmf-native-support/src-gen/main/resources/META-INF/native-image/${project.groupId}/esmf-native-support</relative-native-config-path>
7979
<!-- The path to the native configs as it is reachable from the submodules -->
8080
<native-config-path>${project.basedir}/../../${relative-native-config-path}</native-config-path>
81+
<!-- Can be removed once configured in esmf-parent -->
82+
<central-publishing-maven-plugin-version>0.8.0</central-publishing-maven-plugin-version>
8183
</properties>
8284

8385
<dependencyManagement>
@@ -231,6 +233,17 @@
231233
</dependencies>
232234

233235
<build>
236+
<!-- Can be removed once configured in esmf-parent -->
237+
<pluginManagement>
238+
<plugins>
239+
<plugin>
240+
<groupId>org.sonatype.central</groupId>
241+
<artifactId>central-publishing-maven-plugin</artifactId>
242+
<version>${central-publishing-maven-plugin-version}</version>
243+
</plugin>
244+
</plugins>
245+
</pluginManagement>
246+
234247
<plugins>
235248
<plugin>
236249
<groupId>org.apache.maven.plugins</groupId>
@@ -283,6 +296,27 @@
283296
</filesets>
284297
</configuration>
285298
</plugin>
299+
300+
<plugin>
301+
<groupId>org.apache.maven.plugins</groupId>
302+
<artifactId>maven-deploy-plugin</artifactId>
303+
<version>${maven-deploy-plugin-version}</version>
304+
<configuration>
305+
<skip>true</skip>
306+
</configuration>
307+
</plugin>
308+
309+
<plugin>
310+
<groupId>org.sonatype.central</groupId>
311+
<artifactId>central-publishing-maven-plugin</artifactId>
312+
<extensions>true</extensions>
313+
<configuration>
314+
<publishingServerId>central</publishingServerId>
315+
<autoPublish>false</autoPublish>
316+
<skipPublishing>true</skipPublishing>
317+
<outputFilename>central-bundle.zip</outputFilename>
318+
</configuration>
319+
</plugin>
286320
</plugins>
287321
</build>
288322

0 commit comments

Comments
 (0)