Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 13 additions & 50 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: Publish to Maven Central

on:
workflow_dispatch:
inputs:
release-version:
description: 'Release version (e.g., 1.0.0)'
required: false
type: string
release:
types: [ created ]

Expand All @@ -26,7 +20,12 @@ jobs:
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'corretto'
distribution: corretto
server-id: central
server-username: SERVER_USERNAME
server-password: SERVER_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE

- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -41,51 +40,15 @@ jobs:
id: locate-python
run: echo "python-path=$(which python)" >> "$GITHUB_OUTPUT"

- name: Import GPG key
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG

- name: Set version from release tag
if: github.event_name == 'release'
run: |
VERSION="${{ github.ref_name }}"
# Remove 'v' prefix if present
VERSION="${VERSION#v}"
mvn versions:set -DnewVersion="$VERSION"

- name: Set version from workflow input
if: github.event_name == 'workflow_dispatch' && inputs.release-version != ''
run: |
mvn versions:set -DnewVersion="${{ inputs.release-version }}"

- name: Create settings.xml for Maven Central
run: |
mkdir -p ~/.m2
cat > ~/.m2/settings.xml << 'EOF'
<settings>
<servers>
<server>
<id>central</id>
<username>${env.CENTRAL_USERNAME}</username>
<password>${env.CENTRAL_TOKEN}</password>
</server>
</servers>
</settings>
EOF

- name: Run tests
run: mvn clean verify
run: mvn versions:set -DnewVersion="${REF_NAME#v}"
env:
ASDF_JAVA_TESTS_PYTHON_PATH: ${{ steps.locate-python.outputs.python-path }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
REF_NAME: ${{ github.ref_name }}

- name: Deploy to Maven Central
run: mvn deploy -DskipTests=true
- name: Publish
run: mvn --batch-mode deploy
env:
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
ASDF_JAVA_TESTS_PYTHON_PATH: ${{ steps.locate-python.outputs.python-path }}
SERVER_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
SERVER_PASSWORD: ${{ secrets.CENTRAL_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
2 changes: 2 additions & 0 deletions aggregate-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

<artifactId>aggregate-report</artifactId>

<name>aggregate-report</name>

<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
Expand Down
18 changes: 4 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>8</maven.compiler.release>
<revision>0.26.0-1</revision>
<revision>dev</revision>
<lombok.version>1.18.36</lombok.version>
<snakeyaml.version>2.4</snakeyaml.version>
<guava.version>33.4.8-jre</guava.version>
Expand Down Expand Up @@ -188,12 +188,6 @@
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -237,6 +231,9 @@
<plugin>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
Expand All @@ -256,13 +253,6 @@
</plugins>
</build>

<distributionManagement>
<repository>
<id>central</id>
<url>https://central.sonatype.com/api/v1/publisher</url>
</repository>
</distributionManagement>

<modules>
<module>roman-datamodels</module>
<module>aggregate-report</module>
Expand Down