./mvnw clean package
./mvnw spring-boot:run
or
docker build -t maven-demo .
docker run -p 8080:8080 maven-demo
This GitHub Actions workflow (on main branch):
- sets up an environment with JDK 11,
- builds a Java application using Maven,
- creates a JAR file,
- uploads it as an artifact,
- retrieves the latest Docker image version from the private GitHub Container Registry,
- increments the version based on a VARIABLE on GITHUB,
- then builds and pushes a Docker image to the private GitHub Container Registry.
- define DOCKER_PAT as a secret to access GitHub Container Registry
- define SEM_VER_INCREMENT as a variable with setting one of the value (MAJOR, MINOR or PATCH)
- Depends on https://github.com/mehmetmgrsl/github-common-workflows
Resources: