DEV Community

Ed Legaspi
Ed Legaspi

Posted on

Stop Rewriting CI/CD: Reusable GitHub Actions for Maven Projects

If you’ve worked on multiple Java projects, you’ve probably run into this:

Every repository has its own version of a CI/CD pipeline.

Slightly different YAML.

Slightly different setup steps.

Slightly different ways of doing the same thing.

And somehow… none of them are reusable.


😤 The Real Problem

It’s not that CI/CD is hard.

It’s that it’s repetitive.

You end up doing the same things over and over:

  • Set up Java
  • Cache Maven dependencies
  • Run tests
  • Build artifacts
  • Handle versioning
  • Publish or release

Then copy that workflow into another repo…

…and tweak it just enough to break consistency.

This is exactly the kind of problem automation should solve — yet we keep duplicating it.


💡 A Different Approach

Instead of treating each pipeline as a one-off YAML file, I started thinking:

What if CI/CD steps were modular and reusable — just like code?

That’s where NERV-Actions came from.

👉 https://github.com/czetsuyatech/nerv-actions


⚙️ What NERV-Actions Is

NERV-Actions is a collection of reusable GitHub Actions designed for Maven-based projects.

The idea is simple:

  • Break CI/CD into small, composable actions
  • Reuse them across repositories
  • Keep pipelines consistent without rewriting everything

Instead of this:

# repeated in every repo
- uses: actions/setup-java@v4
- run: mvn clean install
Enter fullscreen mode Exit fullscreen mode

You plug in reusable building blocks that already handle those concerns.


🧱 Why This Matters

Reusable workflows aren’t just about convenience — they solve real scaling problems.

When you define things once and reuse them:

  • You reduce duplication
  • You avoid inconsistencies across repos
  • You make updates easier (change once, apply everywhere)
  • You spend less time debugging YAML

🧠 Design Philosophy

I didn’t try to build a “one-size-fits-all” pipeline.

Instead, NERV-Actions focuses on:

  • Composable units → mix only what you need
  • Sensible defaults → minimal setup required
  • Consistency → same patterns across projects
  • Extensibility → override when necessary

It’s closer to building blocks than a framework.


🚀 Example Use Case

For a typical Maven project, your pipeline usually boils down to:

  • Run tests
  • Build artifacts
  • Publish packages
  • Create releases

With reusable actions, you don’t redefine these steps every time—you just assemble them.


🤔 Why Not Just Copy-Paste?

Because copy-paste doesn’t scale.

It works for 2–3 repos.

It breaks down at 10+.

Suddenly:

  • Fixes don’t propagate
  • Pipelines drift
  • Debugging becomes inconsistent

Reusable actions solve that by centralizing the logic.


🧪 Still Evolving

This isn’t meant to be a “perfect CI/CD solution.”

It’s a practical attempt to reduce the friction I kept running into across projects.

If you’re dealing with the same repetition in GitHub Actions, this might be useful:

👉 https://github.com/your-repo-link


💬 Curious About Your Setup

Are you:

  • copying workflows between repos?
  • using reusable workflows heavily?
  • or building your own internal action libraries?

Would be interesting to hear how others are handling this.

Top comments (0)