diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..5aa8f8de --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + release: + types: [published] + +jobs: + validate: + uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-build-test.yml@main + secrets: + NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + + spotless: + needs: validate + uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-spotless-check.yml@main + + pre-release: + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + needs: spotless + uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-publish.yml@main + secrets: + NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + + release: + if: ${{ github.event_name == 'release' }} + needs: spotless + uses: mekomsolutions/shared-github-workflow/.github/workflows/maven-publish.yml@main + secrets: + NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} + NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} + + # this job notifies OCD3 of a new pre-release(snapshots) + notify-ocd3: + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + needs: pre-release + uses: mekomsolutions/shared-github-workflow/.github/workflows/ocd3-notify.yml@main + secrets: + OCD3_USERNAME: ${{ secrets.OCD3_USERNAME }} + OCD3_PASSWORD: ${{ secrets.OCD3_PASSWORD }} diff --git a/.ocd3.yml b/.ocd3.yml index 6a7b396d..cfb4a7fb 100644 --- a/.ocd3.yml +++ b/.ocd3.yml @@ -1,6 +1,6 @@ version: 1 build: # Unable to run tests because of no Docker agent available in OCD3 yet. https://mekomsolutions.atlassian.net/browse/INFRA-318 - bash_commands: "mvn clean install -DskipTests" + bash_commands: "echo 'Build is handled by GitHub Actions. Skipping...' && exit 0" deploy: - bash_commands: "mvn clean deploy -DskipTests -DaltDeploymentRepository=mks-nexus::default::https://nexus.mekomsolutions.net/repository/maven-snapshots" + bash_commands: "echo 'Publishing is handled by GitHub Actions. Skipping...' && exit 0" diff --git a/pom.xml b/pom.xml index b53821b0..880aa8e6 100644 --- a/pom.xml +++ b/pom.xml @@ -21,6 +21,19 @@ + + + mks-nexus-public-releases + Mekom Solutions Nexus repo for releases + https://nexus.mekomsolutions.net/repository/maven-releases + + + mks-nexus-public-snapshots + Mekom Solutions Nexus repo for snapshots + https://nexus.mekomsolutions.net/repository/maven-snapshots + + + UTF-8 17