Skip to content
Latchkey

How to Migrate a Jenkins Shared Library to a Reusable Workflow

A Jenkins shared library centralizes pipeline logic; the Actions equivalent is a reusable workflow called with workflow_call, or a composite action for step groups.

Jenkins shared libraries expose reusable steps and pipelines across repos. In Actions, put the shared pipeline in a workflow with on.workflow_call and call it, or bundle step groups into a composite action.

Concept mapping

JenkinsGitHub Actions
shared library vars/*.groovyreusable workflow (workflow_call)
library step used inlinecomposite action (runs.using: composite)
@Library referenceuses: org/repo/.github/workflows/x.yml@ref
library parametersinputs: and secrets:

Reusable workflow (callee)

.github/workflows/build.yml
on:
  workflow_call:
    inputs:
      node-version: { type: string, default: '20' }
    secrets:
      NPM_TOKEN: { required: true }
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: ${{ inputs.node-version }}
      - run: npm ci && npm run build

Caller

.github/workflows/ci.yml
jobs:
  call:
    uses: my-org/ci/.github/workflows/build.yml@main
    with:
      node-version: '20'
    secrets:
      NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

What does not map cleanly

  • Groovy helper logic does not port; rewrite it as shell or a small action.
  • Reusable workflows nest at most four levels deep.
  • A composite action shares steps, not whole jobs; use workflow_call when you need jobs.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →