Skip to content

Commit

Permalink
fix: test publish
Browse files Browse the repository at this point in the history
  • Loading branch information
mosoriob committed Jul 31, 2024
1 parent 2bae94f commit 1afb4ed
Showing 1 changed file with 61 additions and 23 deletions.
84 changes: 61 additions & 23 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,73 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path

name: Maven Package

on:
release:
types: [created]
push:
branches:
- '*'

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Publish to GitHub Packages Apache Maven
run: mvn deploy
env:
GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }}
GITHUB_TOKEN: ${{ github.token }}
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
server-id: ossrh
settings-path: ${{ github.workspace }}

- name: Import GPG key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
run: |
echo "$GPG_PRIVATE_KEY" | gpg --import
gpg --list-secret-keys
- name: Verify GPG Passphrase
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
echo "test message" | gpg --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" --sign --local-user your-key-id
gpg --list-secret-keys
- name: Set up Maven settings
run: |
mkdir -p ~/.m2
echo "<settings>
<servers>
<server>
<id>ossrh</id>
<username>${{ secrets.OSSRH_USERNAME }}</username>
<password>${{ secrets.OSSRH_PASSWORD }}</password>
</server>
</servers>
<profiles>
<profile>
<id>gpg-sign</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.keyname>your-email@example.com</gpg.keyname>
<gpg.passphrase>${{ secrets.GPG_PASSPHRASE }}</gpg.passphrase>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>gpg-sign</activeProfile>
</activeProfiles>
</settings>" > ~/.m2/settings.xml
- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Publish to OSSRH
run: mvn deploy
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

0 comments on commit 1afb4ed

Please sign in to comment.