https://github.com/fn-fal113/mavenbuilds
Java Maven Continuous Deployment/Integration
https://github.com/fn-fal113/mavenbuilds
git github java maven
Last synced: 5 months ago
JSON representation
Java Maven Continuous Deployment/Integration
- Host: GitHub
- URL: https://github.com/fn-fal113/mavenbuilds
- Owner: FN-FAL113
- License: gpl-3.0
- Created: 2022-07-22T11:28:56.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-10-05T15:56:38.000Z (9 months ago)
- Last Synced: 2025-10-05T17:47:13.278Z (9 months ago)
- Topics: git, github, java, maven
- Language: JavaScript
- Homepage:
- Size: 5.14 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MavenBuilds
"Continous Integration/Deployment Service" for java maven packages
Maven packages are uploaded to this repo unless builds repo is edited inside ```./resources/repos.json```.
Defaults to ```clean package``` lifecycle build.
## :interrobang: The Process
### 1. Cloning builds and target repos
Existing local directories are deleted before executing this step.
Remote builds repo gets cloned (first object inside resource file).
Each target repo starting from index 1 inside resource file
are looped for cloning and building.
Cloned repositories directory:
``./cloned_repos/{repoOwner}/``
### 2. Creation of build output directories for each target repo
Before proceeding to maven lifecycle build, the latest commit hash from a target
repo is fetched to check whether a commit hash named subdirectory exists.
If a commit hash named subdirectory exist then maven lifecycle build will be skipped
otherwise the build output directories are created inside the builds repo.
Builds Output Directory:
```
./cloned_repos/{buildsRepoOwner}/{buildsRepoName}/repos/{targetRepoOwner}/{targetRepoName}/{branch}/{latestCommitHash}
```
### 3. Building target repo
After creating the build output directories and no commit hash
subdirectory exist, a maven lifecycle build is initiated using
'clean package' as the life cycle command. The build log gets created
in the root directory of the current target repo.
### 4. Transferring target repo build files
If maven lifecycle build is successful then output files (jar + logs) are the packaged
and transferred to the [cloned builds output directory](#builds_output_directory) else only log file will get transferred
### 5. Commit and push to remote builds repo
These changes are the new commit hash directory where the build files are transferred.
## Assigning builds repo and target repos
Inside ```./resources/repos.json```, where you will be adding the needed builds repo and target repos
Contents are inside a json literal array
```
[
/* index 0 of this json array that serves as your main builds repo
* where the packaged jar and other files will be committed
/*
{
"github_username": "FN-FAL113",
"repository": "MavenBuilds",
"branch": "main"
},
/* index 1 above are your target java maven repos
* each repository should be added per index inside this json array
/* keep in mind, index 0 should be the main builds repository
{
"github_username": "FN-FAL113",
"repository": "FN-FAL-s-Amplifications",
"branch": "main"
},
{
"github_username": "FN-FAL113",
"repository": "RelicsOfCthonia",
"branch": "main"
}
]
```
## To Do
- Feel free to suggest
## Usage
1. Clone this maven builds repo then extract the zip file
2. Run ```npm install```
3. Assign your own builds and target github repos inside ```/resources/repos.json```
4. Change the maven build lifecycle command if necessary inside ```main.js```
5. Supply needed environment variables like ```API_KEY``` and ```EMAIL```, propagate github action secrets if necessary
6. Execute the app ```npm start```
## CI/CD Through Github Actions
- An example workflow I made for this builds repo: [deploy.yml](https://github.com/FN-FAL113/MavenBuilds/blob/main/.github/workflows/deploy.yml)
- An example workflow that I also wrote for a target repo that triggers the workflow for this builds repo on push: [deploy.yml](https://github.com/FN-FAL113/FN-FAL-s-Amplifications/blob/main/.github/workflows/deploy.yml)