Skip to content

Commit

Permalink
Publishing from Maven (#2091)
Browse files Browse the repository at this point in the history
  • Loading branch information
ennru authored Apr 18, 2024
1 parent 0650d36 commit 25658bb
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 29 deletions.
36 changes: 36 additions & 0 deletions .github/publish-maven.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env bash

echo "Extracting the SDK version from sbt build"
SDK_VERSION=$(sbt "print coreSdk/version" | tail -n 1)
IS_SNAPSHOT=$(sbt "print coreSdk/isSnapshot" | tail -n 1)
if [ "true" == "${IS_SNAPSHOT}" ]
then
REPO="akka-repo::default::https://maven.cloudsmith.io/lightbend/akka-snapshots/"
else
REPO="akka-repo::default::https://maven.cloudsmith.io/lightbend/akka/"
fi
echo "Publishing ${SDK_VERSION} to ${REPO}"
echo ${PGP_SECRET} | base64 -d | gpg --import --batch
mkdir -p ~/.m2
cat >~/.m2/settings.xml \<<EOF;
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>akka-repo</id>
<username>${PUBLISH_USER}</username>
<password>${PUBLISH_PASSWORD}</password>
</server>
</servers>
<profiles>
<profile>
<id>release</id>
<properties>
<gpg.passphrase>${PGP_PASSPHRASE}</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
EOF
mvn -B versions:set -DnewVersion=${SDK_VERSION}
mvn -P release -B deploy -DaltDeploymentRepository="${REPO}"
32 changes: 3 additions & 29 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,38 +68,12 @@ jobs:
jvm: temurin:1.17.0.5

- name: Publish maven plugin and archetype
run: |-
cd maven-java
echo $PGP_SECRET | base64 -d | gpg --import --batch
mkdir -p ~/.m2
cat >~/.m2/settings.xml \<<EOF;
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>ossrh</id>
<username>$SONATYPE_USERNAME</username>
<password>$SONATYPE_PASSWORD</password>
</server>
</servers>
<profiles>
<profile>
<id>ossrh</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.passphrase>$PGP_PASSPHRASE</gpg.passphrase>
</properties>
</profile>
</profiles>
</settings>
EOF
mvn -B versions:set -DnewVersion=$SDK_VERSION
mvn -P release -B deploy
run: ./.github/publish-maven.sh
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
PUBLISH_PASSWORD: ${{ secrets.PUBLISH_PASSWORD }}

documentation:
name: Documentation
Expand Down

0 comments on commit 25658bb

Please sign in to comment.