diff --git a/.github/workflows/build-and-release-package.yml b/.github/workflows/build-and-release-package.yml index 9dae682..8d63bc3 100644 --- a/.github/workflows/build-and-release-package.yml +++ b/.github/workflows/build-and-release-package.yml @@ -1,7 +1,6 @@ name: "build-and-release-package" -on: - workflow_dispatch: +on: "workflow_dispatch" concurrency: "${{github.workflow}}-${{github.ref}}" diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index e69de29..0e252d6 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -0,0 +1,39 @@ +name: "build-package" + +on: + push: + branches: [ "main" ] + paths: + - ".github/workflows/build-package.yml" + - "pom.xml" + - "src/**" + workflow_dispatch: + +concurrency: + group: "${{github.workflow}}-${{github.ref}}" + cancel-in-progress: true + +jobs: + build-package: + runs-on: "ubuntu-latest" + permissions: + packages: "write" + steps: + - uses: "actions/checkout@v3" + with: + submodules: "recursive" + + - uses: "actions/setup-java@v4" + with: + java-version: "11" + distribution: "adopt" + server-id: "github" + + - name: "Build package and run tests" + run: "mvn --batch-mode test" + + - if: "github.event_name != 'pull_request'" + name: "Deploy to GitHub" + env: + GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}" + run: "mvn --batch-mode deploy -DskipTests -Pgithub_release"