|
1 | | -General purpose reusable Github Action workflows |
| 1 | +# github-actions-workflows |
| 2 | + |
| 3 | +General purpose reusable GitHub Action workflows and composite actions. |
| 4 | + |
| 5 | +## Versioning and Release Process |
| 6 | + |
| 7 | +Each reusable workflow and composite action in this repository is versioned and |
| 8 | +released **independently** using [Release Please](https://github.com/googleapis/release-please). |
| 9 | +The next version of each component is determined automatically from the |
| 10 | +[Conventional Commits](https://www.conventionalcommits.org/) in pull request |
| 11 | +titles that touched the component's files. |
| 12 | + |
| 13 | +### Components |
| 14 | + |
| 15 | +1. The `Prepare release` GitHub Action workflow |
| 16 | + (`.github/workflows/release-please.yaml`): |
| 17 | + |
| 18 | + * Runs `release-please-action` on every push to `main`. Release Please |
| 19 | + analyzes commit messages since the last release and groups pending |
| 20 | + version bumps into a single, rolling release pull request. |
| 21 | + * The release PR lists one entry per component that has unreleased |
| 22 | + changes, each with its proposed new version and changelog excerpt. |
| 23 | + * Merging the release PR creates the exact version tag for each |
| 24 | + released component (e.g. `build_container_image/v1.2.3`) and writes |
| 25 | + the aggregated entries into the repo-root `CHANGELOG.md`. |
| 26 | + * After the exact tags are created, the same workflow fast-forwards |
| 27 | + the per-component **floating tags** - the major float |
| 28 | + `<component>/vX` and the minor float `<component>/vX.Y` - so they |
| 29 | + point at the same commit. Consumers pinned to a float automatically |
| 30 | + pick up the new release on their next run. |
| 31 | + |
| 32 | +2. The `Lint Pull Request Title` GitHub Action workflow |
| 33 | + (`.github/workflows/lint-pr-title.yaml`): |
| 34 | + |
| 35 | + * Runs on every pull request and uses the |
| 36 | + `amannn/action-semantic-pull-request` action to validate that the |
| 37 | + pull request title follows the Conventional Commits format. |
| 38 | + * This repository squash-merges all pull requests, so the PR title |
| 39 | + becomes the squash commit's subject line. The lint gate therefore |
| 40 | + ensures that Release Please can parse every commit merged into |
| 41 | + `main`. |
| 42 | + |
| 43 | +### Pull Request Title Format |
| 44 | + |
| 45 | +The Conventional Commits preset expects pull request titles to be in the |
| 46 | +following format: |
| 47 | + |
| 48 | + <type>(<scope>): <subject> |
| 49 | + |
| 50 | +* Type: Describes the category of the commit. Examples include: |
| 51 | + * `feat`: A new feature (triggers a minor version bump). |
| 52 | + * `fix`: A bug fix (triggers a patch version bump). |
| 53 | + * `perf`: A code change that improves performance (triggers a patch |
| 54 | + version bump). |
| 55 | + * `refactor`: A code change that neither fixes a bug nor adds a |
| 56 | + feature (triggers a patch version bump unless it is a |
| 57 | + BREAKING CHANGE). |
| 58 | + * `docs`: Documentation-only changes. |
| 59 | + * `chore`: Routine maintenance (e.g. CI tweaks, dependency bumps). |
| 60 | +* Scope: An optional part that provides additional context about what |
| 61 | + was changed (e.g. module, component). |
| 62 | +* Subject: A brief description of the changes. |
| 63 | + |
| 64 | +A commit whose files fall within a component's tracked paths always |
| 65 | +produces at least a patch bump for that component, regardless of type. |
| 66 | +Types like `chore` and `docs` are hidden from the visible `CHANGELOG.md` |
| 67 | +but still participate in version calculation. |
| 68 | + |
| 69 | +### Handling Breaking Changes |
| 70 | + |
| 71 | +To indicate a breaking change, the exclamation mark `!` should be used |
| 72 | +immediately after the type (or type and scope): |
| 73 | + |
| 74 | +* `feat!:` |
| 75 | +* `fix!:` |
| 76 | +* `refactor!:` |
| 77 | + |
| 78 | +A breaking commit bumps the affected components to a new major version. |
| 79 | +Consumers pinned to the previous major float (e.g. |
| 80 | +`@build_container_image/v1`) stay frozen on the old major line — picking |
| 81 | +up the new major requires re-pinning to the new float explicitly. |
| 82 | + |
| 83 | +### Tag Scheme |
| 84 | + |
| 85 | +For every release, three tags are produced per affected component: |
| 86 | + |
| 87 | +| Tag | Mutability | Points at | |
| 88 | +|------------------------|-------------------------------------|-----------------------------------| |
| 89 | +| `<component>/vX.Y.Z` | immutable | The release commit | |
| 90 | +| `<component>/vX.Y` | moves on patch releases | Latest patch of `vX.Y.x` | |
| 91 | +| `<component>/vX` | moves on any non-breaking release | Latest non-breaking of `vX.x.y` | |
| 92 | + |
| 93 | +Consumers reference a component by one of these tags: |
| 94 | + |
| 95 | +```yaml |
| 96 | +# Major float — auto-updates on every non-breaking release (recommended): |
| 97 | +uses: FlowFuse/github-actions-workflows/.github/workflows/build_container_image.yml@build_container_image/v1 |
| 98 | + |
| 99 | +# Minor float — auto-updates only on patches: |
| 100 | +uses: FlowFuse/github-actions-workflows/.github/workflows/build_container_image.yml@build_container_image/v1.2 |
| 101 | + |
| 102 | +# Exact pin — never moves: |
| 103 | +uses: FlowFuse/github-actions-workflows/.github/workflows/build_container_image.yml@build_container_image/v1.2.3 |
| 104 | + |
| 105 | +# Composite actions use the same pattern: |
| 106 | +uses: FlowFuse/github-actions-workflows/actions/npm_test@npm_test/v1 |
| 107 | +``` |
0 commit comments