Merge pull request #16 from Willena/dependabot/maven/junit.version-5.… #44
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-SNAPSHOT | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
jobs: | |
lint: | |
name: Check code formatting | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 11 | |
java-package: jdk | |
cache: 'maven' | |
- name: spotless:check | |
run: mvn --batch-mode --no-transfer-progress spotless:check | |
build_deploy: | |
permissions: | |
contents: write | |
name: Build library | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 11 | |
java-package: jdk | |
cache: 'maven' | |
- name: Ensure snapshot | |
run: | | |
res=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
if ! [[ $res == *"SNAPSHOT"* ]] | |
then | |
echo "Build reserved to snapshots" | |
exit 1 | |
fi | |
- name: Prepare GPG sign | |
env: | |
PRIVATE_KEY_BASE64: ${{ secrets.PRIVATE_KEY_BASE64 }} | |
run: | | |
gpg --version | |
gpg --batch --import <(echo "$PRIVATE_KEY_BASE64" | base64 --decode) | |
- name: Deploy version | |
env: | |
MVN_SETTINGS: ${{ secrets.MVN_SETTINGS }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
run: | | |
echo "$MVN_SETTINGS" | base64 --decode > /tmp/settings.xml | |
mvn --settings /tmp/settings.xml --batch-mode --no-transfer-progress clean deploy -P release |