Skip to content

Commit 415a760

Browse files
committed
Deploy to maven central
1 parent 7d6054d commit 415a760

File tree

3 files changed

+88
-16
lines changed

3 files changed

+88
-16
lines changed

.github/workflows/pre-release-ci.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,42 @@ jobs:
1616
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
1717
restore-keys: |
1818
${{ runner.os }}-maven-
19-
- name: Set up JDK 1.8
19+
- name: Set up Java for publishing to GitHub Packages
2020
uses: actions/setup-java@v1
2121
with:
2222
java-version: 1.8
2323
server-id: github
2424
server-username: GITHUB_ACTOR
2525
server-password: GITHUB_TOKEN
26-
- name: Deploy pre-release version
26+
- name: Deploy pre-release version to GitHub Packages
2727
run: |
2828
pre_release_version=${{ github.event.release.tag_name }}
2929
echo Pre-release version $pre_release_version
3030
mvn versions:set -DnewVersion=$pre_release_version -DgenerateBackupPoms=false
3131
mvn versions:commit
32-
mvn clean deploy -B -V
32+
mvn clean deploy -Pdeploy2Github -B -V
3333
env:
3434
GITHUB_TOKEN: ${{ secrets.ORGANIZATION_TOKEN }}
35+
- name: Set up Java for publishing to Maven Central Repository
36+
uses: actions/setup-java@v1
37+
with:
38+
java-version: 1.8
39+
server-id: ossrh
40+
server-username: MAVEN_USERNAME
41+
server-password: MAVEN_PASSWORD
42+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
43+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
44+
- name: Deploy pre-release version to the Maven Central Repository
45+
run: |
46+
pre_release_version=${{ github.event.release.tag_name }}
47+
echo Pre-release version $pre_release_version
48+
mvn versions:set -DnewVersion=$pre_release_version -DgenerateBackupPoms=false
49+
mvn versions:commit
50+
mvn deploy -Pdeploy2Maven -DskipTests -B -V
51+
env:
52+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
53+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
54+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
3555
- name: Rollback pre-release (remove tag)
3656
if: failure()
3757
run: git push origin :refs/tags/${{ github.event.release.tag_name }}

.github/workflows/release-ci.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
2020
restore-keys: |
2121
${{ runner.os }}-maven-
22-
- name: Set up JDK 1.8
22+
- name: Set up Java for publishing to GitHub Packages
2323
uses: actions/setup-java@v1
2424
with:
2525
java-version: 1.8
@@ -44,10 +44,30 @@ jobs:
4444
-Darguments="-DskipTests=true -Ddockerfile.skip=true"
4545
echo ::set-output name=release_tag::$(git describe --tags --abbrev=0)
4646
- name: Perform release
47-
run: mvn -B release:perform -Darguments="-DskipTests=true -Ddockerfile.skip=true"
47+
run: mvn -B release:perform -Pdeploy2Github -Darguments="-DskipTests=true -Ddockerfile.skip=true -Pdeploy2Github"
4848
env:
4949
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5050
GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
51+
- name: Set up Java for publishing to Maven Central Repository
52+
uses: actions/setup-java@v1
53+
with:
54+
java-version: 1.8
55+
server-id: ossrh
56+
server-username: MAVEN_USERNAME
57+
server-password: MAVEN_PASSWORD
58+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
59+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
60+
- name: Deploy release version to the Maven Central Repository
61+
run: |
62+
release_version=$(echo ${{ steps.prepare_release.outputs.release_tag }} | sed "s/release-//")
63+
echo release version $release_version
64+
mvn versions:set -DnewVersion=$release_version -DgenerateBackupPoms=false
65+
mvn versions:commit
66+
mvn deploy -Pdeploy2Maven -DskipTests -B -V
67+
env:
68+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
69+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
70+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
5171
- name: Rollback release
5272
if: failure()
5373
run: |

pom.xml

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>io.scalecube</groupId>
77
<artifactId>scalecube-parent-pom</artifactId>
8-
<version>0.2.17</version>
8+
<version>0.2.19</version>
99
</parent>
1010

1111
<artifactId>scalecube-services-parent</artifactId>
@@ -48,14 +48,6 @@
4848
</repository>
4949
</repositories>
5050

51-
<distributionManagement>
52-
<repository>
53-
<id>github</id>
54-
<name>GitHub Packages</name>
55-
<url>https://maven.pkg.github.com/scalecube/scalecube-services</url>
56-
</repository>
57-
</distributionManagement>
58-
5951
<scm>
6052
<url>https://github.com/scalecube/scalecube-services</url>
6153
<connection>scm:git:https://github.com/scalecube/scalecube-services.git</connection>
@@ -65,8 +57,8 @@
6557
</scm>
6658

6759
<properties>
68-
<scalecube-cluster.version>2.6.2</scalecube-cluster.version>
69-
<scalecube-commons.version>1.0.11</scalecube-commons.version>
60+
<scalecube-cluster.version>2.6.5</scalecube-cluster.version>
61+
<scalecube-commons.version>1.0.12</scalecube-commons.version>
7062
<reactor.version>Dysprosium-SR9</reactor.version>
7163

7264
<jackson.version>2.11.0</jackson.version>
@@ -251,4 +243,44 @@
251243
</pluginRepository>
252244
</pluginRepositories>
253245

246+
<profiles>
247+
<profile>
248+
<id>deploy2Github</id>
249+
<distributionManagement>
250+
<repository>
251+
<id>github</id>
252+
<name>GitHub Packages</name>
253+
<url>https://maven.pkg.github.com/scalecube/scalecube-services</url>
254+
</repository>
255+
</distributionManagement>
256+
</profile>
257+
<profile>
258+
<id>deploy2Maven</id>
259+
<distributionManagement>
260+
<repository>
261+
<id>ossrh</id>
262+
<name>Central Repository OSSRH</name>
263+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
264+
</repository>
265+
</distributionManagement>
266+
<build>
267+
<plugins>
268+
<plugin>
269+
<groupId>org.sonatype.plugins</groupId>
270+
<artifactId>nexus-staging-maven-plugin</artifactId>
271+
</plugin>
272+
<plugin>
273+
<artifactId>maven-source-plugin</artifactId>
274+
</plugin>
275+
<plugin>
276+
<artifactId>maven-javadoc-plugin</artifactId>
277+
</plugin>
278+
<plugin>
279+
<artifactId>maven-gpg-plugin</artifactId>
280+
</plugin>
281+
</plugins>
282+
</build>
283+
</profile>
284+
</profiles>
285+
254286
</project>

0 commit comments

Comments
 (0)