Skip to content

Commit

Permalink
ci: add package deployment on release
Browse files Browse the repository at this point in the history
  • Loading branch information
dogukancagatay committed Nov 28, 2024
1 parent 4d28811 commit f7c5205
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Main Build

on:
push:
branches:
- release-0.5.0
release:
types: [created]

env:
JAVA_VERSION: "8"
MAVEN_PROFILE: "gh-action"

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: "temurin"
cache: maven
server-id: central # Value of the publishingServerId of central-publishing-maven-plugin plugin of the pom.xml
server-username: MAVEN_USERNAME # Value of the server username in the settings.xml
server-password: MAVEN_CENTRAL_TOKEN # Value of the server password in the settings.xml
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of armored the private key
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Publish package to Sonatype Maven Central
run: mvn -B -P ${{ env.MAVEN_PROFILE}} -Dgpg.keyname=${{ secrets.MAVEN_GPG_KEYNAME }} deploy
29 changes: 29 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,29 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<gpg.pinentry_mode>default</gpg.pinentry_mode>
<package.autoPublish>false</package.autoPublish>
<package.skipPublishing>true</package.skipPublishing>
</properties>
</profile>
<profile>
<id>gh-action</id>
<properties>
<gpg.pinentry_mode>loopback</gpg.pinentry_mode>
<package.autoPublish>true</package.autoPublish>
<!-- <package.skipPublishing>false</package.skipPublishing>-->
<package.skipPublishing>true</package.skipPublishing>
</properties>
</profile>
</profiles>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -82,6 +105,10 @@
</goals>
<configuration>
<keyname>${gpg.keyname}</keyname>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>${gpg.pinentry_mode}</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
Expand All @@ -93,6 +120,8 @@
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<skipPublishing>${package.skipPublishing}</skipPublishing>
<autoPublish>${package.autoPublish}</autoPublish>
<waitUntil>published</waitUntil>
</configuration>
</plugin>
Expand Down

0 comments on commit f7c5205

Please sign in to comment.