Forem

Bervianto Leo Pratama
Bervianto Leo Pratama

Posted on • Originally published at berviantoleo.Medium on

Set up CI/CD at Github for Gradle (Java)

It long time to understand because I am really a newcomer. :(

I just curious how to set up CI especially when using Gradle. Many tasks can be automated when using Gradle, so I have the inspiration to create CI/CD from this.

Sample Projects

I create a sample project with the name PDFUtil. What is that? Sometimes I need to remove the password from the PDF, not really common actually. So, I try to build it, takes a long time to build or develop because quite new in Java language world. I do not understand at a low level, so I try to find a higher-level library that helps me to open and remove the password. (Anyway, I need to know the password first, I’m quite lazy to create the guesser, please create with your own. :D) Okay so, in short, this is my repository.

bervProject/PDFUtil

I’m not want to tell you how I create the app, but for TLDR., I have some main components, there are plugin id and Gradle tasks (distTar & distZip). So, I need to have a plugin id with the name application . After that, the main task for deployment is distTar & distZip . For the CI, actually, I will need tasks like build & test . But, because I’m not finished to create the unit test, so I will skip the test.

Github Action

Next, we go to workflow or CI/CD flow. I use Github Action so it will easy to integrate with another release function from Github Platform itself.

The steps by steps of my workflow:

  1. Checkout source code
  2. Setup java (in this case, I use java 11)
  3. Gradle Build
  4. Gradle Dist (distTar & distZip)
  5. Publish Release (only when tagging)

So, I use conditions at steps 4 & 5, only trigger when I push the tag and will create the Github Release.

To publish a release, I use this Github action:

softprops/action-gh-release

Thank you so much for the Github action!

To Do

Actually, I still need to improve more aspects like CI (unit test and end-to-end test). Also, need release summarization (maybe pull all the commit message and summarize it to Github Release). Many homework that I should do!

Finally

Here we are, you can see the result, I included the dist command result to Github Releases.

Github Release

At least, I can minimize some manual tasks for the release or deployment. It’s quite good. So, how about you? Do you have a different opinion? It’s okay, tell me, I hope I can improve my skills in CI/CD process especially at DevOps.

Thank you!

Photo by Hanny Naibaho on Unsplash

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay