From b44af42d116ab74c53184646bdb1cce0c79322e0 Mon Sep 17 00:00:00 2001 From: Gang Li Date: Fri, 5 Jan 2024 21:28:32 +0800 Subject: [PATCH] Add github actions for CI --- .github/workflows/maven-build.yml | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/maven-build.yml diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml new file mode 100644 index 0000000..6187f36 --- /dev/null +++ b/.github/workflows/maven-build.yml @@ -0,0 +1,51 @@ +name: build on maven + +on: + watch: + types: [started] + pull_request: + types: [opened, reopened, edited, synchronize, ready_for_review] + push: + branches: + - main + - master + + workflow_dispatch: + +jobs: + build: + name: Build with maven + runs-on: ubuntu-latest + env: + MAVEN_OPTS: "-Xmx4096m -Xms2048m -XX:MaxMetaspaceSize=4096m -Xss8m" + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 11 for x64 + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'temurin' + architecture: x64 + + - uses: s4u/maven-settings-action@v2.8.0 + with: + sonatypeSnapshots: true + + - name: Build the Maven verify phase + run: mvn -B -V clean verify -Prun-its -Pci + + + - uses: s4u/maven-settings-action@v2.8.0 + if: ${{ github.event_name == 'push' }} + with: + servers: | + [{ + "id": "sonatype-nexus-snapshots", + "username": "${{ secrets.SONATYPE_BOT_USERNAME }}", + "password": "${{ secrets.SONATYPE_BOT_TOKEN }}" + }] + + - name: Deploy the artifact + if: ${{ github.event_name == 'push' }} + run: mvn help:effective-settings -B -V clean deploy -e