This repository is a POC for using the action located at: https://github.com/marketplace/actions/action-monorepo-version-tags-lifecycle
The repository holds a product with two components.
Description | Location | |
---|---|---|
product | Main application in python. | app folder |
product deploy | Helm chart with two components. | metaapp/ folder |
component | Hello Component python app. | hello-world/ folder |
component | ByeBye Component python app. | byebye-world/ folder |
There are one workflow for each component, one workflow for the product and another one to create release branches.
The workflow runs on:
on:
pull_request:
branches:
- main
- "release/v*"
paths:
- "hello-world/**/*"
- ".github/workflows/hello-*"
push:
branches:
- main
- "release/v*"
paths:
- "hello-world/**/*"
- ".github/workflows/hello-*"
Job | Description> | Conditional on |
quality-checks |
Run all quality checks for the component. Linter & Tests. | |
create-release-tag |
Creates a new tag for the component. |
if: github.ref == 'refs/heads/main' # only in main branch |
create-fix-tag |
Creates a new tag for the component. |
if: startsWith(github.ref, 'refs/heads/release') # only in release branches |
build-release |
Create a new build artifact for the component. |
if: | always() && (needs.create-release-tag.outputs.tag || needs.create-fix-tag.outputs.tag) |
The workflow runs on:
on:
workflow_run:
workflows:
- "Hello Component Build"
- "ByeBye Component Build"
- "App Application Build"
types:
- completed
Job | Description> | Conditional on |
[calculate|create]-rc-tag |
Calculates or creates the next pre-release tag. |
# Just after a workflow completes successfully and the workflows was triggered in main branch if: | github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main' |
[calculate|create]-fix-tag |
Calculates or creates the next fix tag. |
# Just after a workflow completes successfully and the workflows was triggered in a release branch if: | github.event.workflow_run.conclusion == 'success' && startsWith(github.event.workflow_run.head_branch, 'release') |
release |
Release a new version of the product Chart with new versions. |
if: | always() && (needs.calculate-rc-tag.outputs.tag || needs.calculate-fix-tag.outputs.tag || needs.calculate-release-tag.outputs.tag) |
The workflow runs on:
on:
workflow_dispatch:
Job | Description> | Conditional on |
create-release-branch |
Creates a new release branch. | |
[calculate/create]-release-tag |
Calculates the next release tag. | |
release |
Generates a new release of the chart. |