Update maven-plugins #103
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: Build and test | |
on: | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Get branch names. | |
id: branch-names | |
uses: tj-actions/branch-names@6871f53176ad61624f978536bbf089c574dc19a2 # v8 | |
- name: Checkout project | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Cache Maven repository | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Set up JDK 21 | |
uses: actions/setup-java@2dfa2011c5b2a0f1489bf9e433881c92c1631f88 # v4 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
cache: maven | |
- name: Setup Maven server settings | |
uses: s4u/maven-settings-action@7802f6aec16c9098b4798ad1f1d8ac75198194bd # v3.0.0 | |
with: | |
servers: | | |
[{ | |
"id": "nvd", | |
"username": "john.doe", | |
"password": "${{ secrets.NVD_KEY }}" | |
}] | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Extract version from POM | |
id: extract_version | |
run: | | |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Upload Windows service SNAPSHOT | |
if: steps.branch-names.outputs.current_branch == 'main' | |
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2 | |
with: | |
name: v${{ env.VERSION }} | |
tag_name: v${{ env.VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: true | |
prerelease: false | |
files: | | |
target/repository-*.zip | |
target/repository-*.json | |
target/repository-*.xml |