← Projects

github-reusable-workflows

GitHub Actions · MIT · Active

On this page

Code

When every repository copies the same release and delivery workflow, a fix to one has to be repeated in all of them. github-reusable-workflows keeps these workflows in one place, made for Bruno’s open-source repositories: one fix, one new tag, and each repository moves up to it when it wants. Anyone who uses them pins a tag (@vX.Y.Z).

The flow

Diagram: the calling repository’s workflow uses release-please.yml, pr-title.yml, mulesoft-library.yml or mulesoft-app.yml, which calls mulesoft-deploy.yml, through uses with the tag vX.Y.Z; a fix here becomes a new tag vX.Y.Z, and each repository moves up to it when it wants.

The calling repository picks the workflow and the tag in uses:. A fix made here becomes a new tag, and each repository that uses it moves up in its own pull request.

What it does

  • release-please.yml: keeps the release pull request up to date; when it is merged, the vX.Y.Z tag and the GitHub release are created.
  • pr-title.yml: fails a pull request whose title is not a Conventional Commit, since the squash merge turns the title into the commit that release-please reads.
  • mulesoft-library.yml: build on the pull request and, on merge, the Maven release published to Exchange.
  • mulesoft-app.yml: main to TEST, release/X.Y.Z to UAT, the tag to PROD with approval, and the back-merge. mulesoft-deploy.yml is called only by it.

The MuleSoft workflows do not run MUnit; the reason and the setup are in mulesoft/README.md.

Getting started

In the calling repository, release-please needs release-please-config.json, .release-please-manifest.json, a GitHub App of its own for releases and the release-please environment. The pull request title is the simplest part, but it needs the squash merge to use the title as the commit message and pr-title / conventional-commit to be a required check:

name: Title
on:
  pull_request:
    types: [opened, edited, synchronize, reopened]
permissions: {}
jobs:
  pr-title:
    uses: brunosouzas/github-reusable-workflows/.github/workflows/pr-title.yml@v0.1.0

Code for this page