This is the repository of the backend for my builds-page. The page can be found here: https://poma123.github.io/builds/
This kinda serves as a "Continous Deployment" Service for Maven Projects, but it utilises GitHub Pages.
The code itself is basically just a basic node.js Program.
It reads repositories from 'resources/repos.json' and connects to the GitHub-API.
If you are interested in the specifics, then feel free to keep on reading.
The first step is to retrieve the latest commit from GitHub's API.
It will compare that commit's timestamp to the locally stored repository.
If the remote version is newer or if there isn't even a local version, we are calculating the new build id.
After that it will proceed to step 2.
After we established that our repository is out of date, this program will git clone
said repository.
It will also locate it's pom.xml file and set the version to "DEV - $id (git $commit)".
This is the easiest step, the program just runs mvn clean package -B
to compile our Maven Project.
It will also catch the state (Success / Failure).
If you enabled Sonar-Integration for this project, then it will also run a sonar-scan on the repository.
Since the page can also display some additional information, the program will now fetch the project's license and tags.
It will also relocate the compiled jar to our main project directory.
Now the program will update our local builds.json file for the project.
It will add the newly compiled build, set the latest and lastSuccessful version
and it's going to tag any builds that match up with our previously fetched tags, with that tag.
Then it will generate a fresh index.html page for the project (from "resources/template.html").
And it will also generate a Status Badge (see "resources/badge.svg").
If we specified a discord webhook, it will also post a message on your discord server.
Now that everything completed, the program will add, commit and push all changed files to this repository.
After it's done, it will clear out any source files that arised during git clone
.