use latest v of actions #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: BOM Builder | |
on: | |
workflow_call: | |
inputs: | |
baseDir: | |
description: 'Base Directory with suffix /' | |
required: true | |
type: string | |
default: '' | |
name: | |
description: 'BOM Name' | |
required: true | |
type: string | |
default: '' | |
publishToCentral: | |
description: 'Whether or not to publish to the central repository' | |
required: false | |
type: boolean | |
default: false | |
secrets: | |
USERNAME: | |
required: true | |
description: 'Username for Github' | |
USER_TOKEN: | |
required: true | |
description: 'The supplied token for Github' | |
SONA_USERNAME: | |
required: true | |
description: 'Username for Maven Central' | |
SONA_PASSWORD: | |
required: true | |
description: 'Passphrase for Maven Central' | |
GPG_PASSPHRASE: | |
required: false | |
description: 'Passphrase for GPG' | |
GPG_PRIVATE_KEY: | |
required: false | |
description: 'A GPG private key ' | |
permissions: | |
contents: read | |
packages: write | |
env: | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
matrix: | |
java-version: [ 21 ] | |
name: ${{ inputs.name }} Builder | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java | |
with: | |
java-version: ${{ matrix.java-version }} | |
distribution: 'oracle' | |
#server-id: github_token | |
#settings-path: ${{ github.workspace }} | |
# cache: 'maven' | |
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
gpg-passphrase: GPG_PASSPHRASE | |
- name: Update Settings.xml | |
uses: whelk-io/maven-settings-xml-action@v21 | |
with: | |
servers: > | |
[ | |
{ | |
"id": "github", | |
"username": "${{secrets.USERNAME}}", | |
"password": "${{secrets.USER_TOKEN}}" | |
}, | |
{ | |
"id": "packages", | |
"username": "${{secrets.USERNAME}}", | |
"password": "${{secrets.USER_TOKEN}}" | |
}, | |
{ | |
"id": "sona-snapshot", | |
"username": "${{secrets.SONA_USERNAME}}", | |
"password": "${{secrets.SONA_PASSWORD}}" | |
}, | |
{ | |
"id": "sona-release", | |
"username": "${{secrets.SONA_USERNAME}}", | |
"password": "${{secrets.SONA_PASSWORD}}" | |
} | |
] | |
repositories: > | |
[ | |
{ | |
"id": "packages", | |
"name": "packages", | |
"url": "https://maven.pkg.github.com/GuicedEE/Packages", | |
"releases": { | |
"enabled": "true" | |
}, | |
"snapshots": { | |
"enabled": "true" | |
} | |
}, | |
{ | |
"id": "shibboleth", | |
"name": "shibboleth", | |
"url": "https://build.shibboleth.net/nexus/content/repositories/releases", | |
"releases": { | |
"enabled": "true" | |
}, | |
"snapshots": { | |
"enabled": "true" | |
} | |
} | |
] | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.m2/repository | |
key: maven-${{ hashFiles('**pom.xml') }} | |
restore-keys: | | |
maven- | |
- name: Listings | |
run: ls -l | |
- name: Run Listings | |
run: | | |
cd ${{inputs.baseDir}} | |
ls -l | |
cd .. | |
- name: Build | |
run: | |
mvn -B package --file ${{inputs.baseDir}}pom.xml -U | |
- name: Publish | |
run: mvn deploy --file ${{inputs.baseDir}}pom.xml -Dignore.moditect=true | |
- name: Publish To Central | |
if: inputs.publishToCentral | |
run: | |
mvn org.apache.maven.plugins:maven-gpg-plugin:sign deploy -Psonatype-distribution,release --file ${{inputs.baseDir}}pom.xml -Dignore.moditect=true -Dgpg.passphrase=${{secrets.GPG_PASSPHRASE}} |