Skip to content
Draft
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
36 changes: 36 additions & 0 deletions .github/workflows/release-java-mvn.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release Java packages
on:
workflow_call:
inputs:
java-version:
description: 'Java version to use'
required: false
default: '21'
type: string
java-distribution:
description: 'Java distribution to use, see https://github.com/actions/setup-java?tab=readme-ov-file#supported-distributions'
required: false
default: 'temurin'
type: string

jobs:
publish:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v5

- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.java-version }}
distribution: ${{ inputs.java-distribution }}

- name: Publish to GitHub Packages
run: mvn --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,51 @@ jobs:
1. Replace this with the actual name of the image, usually something like the
name of your repo with maybe a `container-image-` prefix removed.

### Java

Java support is EXPERIMENTAL and being gradually improved. The initial target is Maven based projects.

#### Java Maven Release

You need to add a `distributionManagement` tag to configure this action:

```xml title="pom.xml"
<project ...>
...
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/radiorabe/repo</url>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add info on the mvn registry needing auth even when public

</repository>
</distributionManagement>
</project>
```

Then you can call `mvn deploy`

```yaml title=".github/workflows/release.yaml"
name: Release

on:
pull_request:
push:
branches: [main]
release:
types: [created]


jobs:
java-maven:
uses: radiorabe/actions/.github/workflows/release-java-mvn.yaml@v0.0.0
with:
java-version: '21' # (1)
java-distribution: 'temurin' # (2)
```

1. We use LTS versions of Java that are available on RHEL style distros.
2. The Temurin Java distribution is fine for deployment purposes.

### Pre Commit

Create the main `.github/workflows/test.yaml` file for a project that supports [pre-commit](https://pre-commit.com/):
Expand Down