diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 463f87e..7e36a00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,37 +1,44 @@ -## A basic GitHub Actions workflow for your Quarkus application. +## Library CI: build + test on every push/PR; publish to Maven Central only on +## a merge to main. Other branches / pull requests build only (no publish). name: CI on: - pull_request_target: + push: + branches: [ main ] + pull_request: branches: [ main ] workflow_dispatch: env: - QUARKUS_CONTAINER_IMAGE_USERNAME: ${{ secrets.DOCKER_HUB_LOGIN }} - QUARKUS_CONTAINER_IMAGE_PASSWORD: ${{ secrets.DOCKER_HUB_PWD }} MVN_SETTINGS: ${{ secrets.MVN_SETTINGS }} GPG_KEY: ${{ secrets.GPG_KEY }} - jobs: build: runs-on: ubuntu-latest steps: - name: Checkout gh-repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: 17 distribution: temurin cache: maven - - - name: Build + + - name: Build (no publish) + run: | + echo "${MVN_SETTINGS}" > /tmp/settings.xml + mvn -B -ntp verify -Dgpg.skip=true -s /tmp/settings.xml + rm -f /tmp/settings.xml + + - name: Publish to Maven Central + if: github.event_name == 'push' && github.ref == 'refs/heads/main' run: | - echo ${MVN_SETTINGS} > /tmp/settings.xml + echo "${MVN_SETTINGS}" > /tmp/settings.xml echo -n "$GPG_KEY" | base64 --decode | gpg --import - mvn deploy -s /tmp/settings.xml + mvn -B -ntp deploy -DskipTests -s /tmp/settings.xml rm -f /tmp/settings.xml rm -rf /home/runner/.gpg diff --git a/.gitignore b/.gitignore index aa43666..6e4574b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,4 @@ -/target/ -bin/ - -#Maven +# Maven target/ pom.xml.tag pom.xml.releaseBackup @@ -9,25 +6,29 @@ pom.xml.versionsBackup release.properties .flattened-pom.xml +# Compiled output / vendored jars +bin/ +lib/ +*.class + # Eclipse .project .classpath .settings/ -/bin/ -/lib/ +.factorypath +.apt_generated/ -# IntelliJ -.idea -*.ipr +# IntelliJ IDEA +.idea/ *.iml +*.ipr *.iws # NetBeans nb-configuration.xml -# Visual Studio Code -.vscode -.factorypath +# VS Code +.vscode/ # OSX .DS_Store @@ -36,10 +37,6 @@ nb-configuration.xml *.swp *.swo -# patch +# Patch / merge leftovers *.orig *.rej - -# Local environment -.env -/test