Skip to content

Commit

Permalink
update release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
8naama committed Dec 31, 2024
1 parent 294624a commit fba0732
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 24 deletions.
39 changes: 15 additions & 24 deletions .github/workflows/mvn-deploy-release.yaml
Original file line number Diff line number Diff line change
@@ -1,37 +1,28 @@
name: Logback Appender Maven CI
name: Release new version to Maven

on:
release:
types: [created]
types: [published]

jobs:
publish:
runs-on: ubuntu-latest
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MVN_MASTER_PASSWORD: ${{ secrets.MVN_MASTER_PASSWORD }}
steps:
- name: Check out Git repository
- name: Get the code
uses: actions/checkout@v4
- name: Install Java and Maven
- name: Setup Java 11
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'zulu'
- name: Create settings-security.xml
run: |
echo '<settingsSecurity>' > ~/.m2/settings-security.xml
echo " <master>${{ secrets.MVN_MASTER_PASSWORD }}</master>" >> ~/.m2/settings-security.xml
echo '</settingsSecurity>' >> ~/.m2/settings-security.xml
- name: Release Maven package
uses: samuelmeuli/[email protected]
with:
maven_profiles: deploy
gpg_private_key: ${{ secrets.GPG_KEY }}
gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }}
nexus_username: ${{ secrets.OSSRH_USERNAME }}
nexus_password: ${{ secrets.OSSRH_PASSWORD }}
server_id: ossrh-nexus
server-id: ossrh-nexus
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.GPG_KEY }}
gpg-passphrase: GPG_PASSPHRASE
- name: Publish to the Maven Central Repository
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: mvn deploy --batch-mode -D skipTests --activate-profiles release --no-transfer-progress
29 changes: 29 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,33 @@
<scope>test</scope>
</dependency>
</dependencies>

<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

0 comments on commit fba0732

Please sign in to comment.