diff --git a/.github/workflows/release-java-mvn.yaml b/.github/workflows/release-java-mvn.yaml new file mode 100644 index 0000000..d2897c8 --- /dev/null +++ b/.github/workflows/release-java-mvn.yaml @@ -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 }} diff --git a/README.md b/README.md index ccd844f..d364372 100644 --- a/README.md +++ b/README.md @@ -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" + + ... + + + github + GitHub Packages + https://maven.pkg.github.com/radiorabe/repo + + + +``` + +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/):