This repository contains the task-api application, a Java Spring Boot application, and a GitHub Actions workflow for Continuous Integration (CI) and Continuous Deployment (CD).
task-api/: The Java Spring Boot application..github/workflows/ci-cd.yaml: The GitHub Actions workflow definition.
The CI/CD pipeline is implemented using GitHub Actions and is triggered on every push to the main branch. The workflow performs the following steps:
- Checkout Code: Fetches the latest code from the repository.
- Set up JDK 17: Configures the Java Development Kit environment.
- Build with Maven: Compiles the Java application and runs tests using Apache Maven.
- Login to Docker Hub: Authenticates with Docker Hub using secrets.
- Build and Push Docker Image: Builds a Docker image of the
task-apiapplication and pushes it to Docker Hub.
Ensure this repository is linked to your GitHub account.
For the Docker login and push steps to work, you need to set up the following secrets in your GitHub repository:
DOCKER_USERNAME: Your Docker Hub username.DOCKER_PASSWORD: Your Docker Hub access token (recommended for security).
To do this:
- Go to your GitHub repository ().
- Click on "Settings".
- In the left sidebar, click on "Secrets and variables" > "Actions".
- Click on "New repository secret" and add the two secrets mentioned above.
The workflow will automatically trigger on any push to the main branch. You can also manually trigger it from the "Actions" tab in your GitHub repository.
You can monitor the progress and view the logs of your CI/CD pipeline by visiting the "Actions" tab in your GitHub repository: