Skip to content

Commit 332b6b6

Browse files
author
Bastian Schwarz
committed
Add docs
1 parent 2126db1 commit 332b6b6

1 file changed

Lines changed: 130 additions & 0 deletions

File tree

README.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,132 @@
11
# workflows.common
22
Contains common workflows like updating changelogs etc.
3+
4+
NOTE: All examples use @release. You should pin this to a major semver version.
5+
6+
Also have a look at the parameters of the workflows in their files. They are documented there. No need to duplicate it here.
7+
All workflows that are prefixed with self_ are workflows that are for this repo only like release management and cannot be called.
8+
9+
## Workflows
10+
11+
### Calculate Version
12+
13+
This workflow calculates the version based on the latest tag and the current branch. It then sets the
14+
version as an output which can be used in other workflows.
15+
16+
```yaml
17+
name: Prepare Release
18+
on:
19+
push:
20+
branches: [ release ]
21+
paths-ignore:
22+
- '**.md'
23+
24+
jobs:
25+
calculate_next_version:
26+
uses: codenamephp/workflows.common/.github/workflows/calculate-next-version.yml@relase
27+
update_changelog:
28+
uses: codenamephp/workflows.common/.github/workflows/update-changelog.yml@release
29+
needs: calculate_next_version
30+
with:
31+
ref: ${{github.ref_name}}
32+
future-release: ${{ needs.calculate_next_version.outputs.version }}
33+
release-branch: 'release'
34+
```
35+
36+
### Update Changelog
37+
38+
This workflow updates the changelog file with the latest changes. This works when all your features are
39+
developed in a feature branch and merged using a pull request.
40+
41+
```yaml
42+
name: Update Changelog
43+
on:
44+
push:
45+
branches: [ main ]
46+
paths-ignore:
47+
- "**.md"
48+
49+
jobs:
50+
update_changelog:
51+
uses: codenamephp/workflows.common/.github/workflows/update-changelog.yml@release
52+
with:
53+
ref: ${{github.ref_name}}
54+
```
55+
56+
This works best in conjuction with the Calculate Version workflow.
57+
58+
### Draft Release
59+
60+
This workflow creates a draft release with the latest changes. This works when all your features are
61+
developed in a feature branch and merged using a pull request.
62+
63+
This works well with the calculate version workflow.
64+
65+
```yaml
66+
name: Prepare Release
67+
on:
68+
push:
69+
branches: [ release ]
70+
paths-ignore:
71+
- '**.md'
72+
73+
jobs:
74+
calculate_next_version:
75+
uses: codenamephp/workflows.common/.github/workflows/calculate-next-version.yml@release
76+
draft_release:
77+
needs: calculate_next_version
78+
uses: codenamephp/workflows.common/.github/workflows/draft-release.yml@release
79+
with:
80+
version: ${{ needs.calculate_next_version.outputs.version }}
81+
```
82+
### Update Release Versions
83+
84+
This workflow is intended for reusable workflow repos (like this one). It will update the major and minor tags.
85+
86+
```yaml
87+
name: Update Release Versions
88+
89+
on:
90+
release:
91+
types:
92+
- published
93+
94+
jobs:
95+
update_release_versions:
96+
uses: codenamephp/workflows.common/.github/workflows/updateReleaseVersions.yml@release
97+
with:
98+
version: ${{ github.event.release.tag_name }}
99+
release_ref: ${{ github.event.release.target_commitish }}
100+
```
101+
102+
## Examples
103+
104+
### Prepare Relase
105+
106+
This workflow can be used to automatically prepare a release. It will calculate the next version, update
107+
the changelog and create a draft release. This is based on a dedicated release branch.
108+
109+
```yaml
110+
name: Prepare Release
111+
on:
112+
push:
113+
branches: [ release ]
114+
paths-ignore:
115+
- '**.md'
116+
117+
jobs:
118+
calculate_next_version:
119+
uses: codenamephp/workflows.common/.github/workflows/calculate-next-version.yml@release
120+
draft_release:
121+
needs: calculate_next_version
122+
uses: codenamephp/workflows.common/.github/workflows/draft-release.yml@release
123+
with:
124+
version: ${{ needs.calculate_next_version.outputs.version }}
125+
update_changelog:
126+
uses: codenamephp/workflows.common/.github/workflows/update-changelog.yml@release
127+
needs: calculate_next_version
128+
with:
129+
ref: ${{github.ref_name}}
130+
future-release: ${{ needs.calculate_next_version.outputs.version }}
131+
release-branch: 'release'
132+
```

0 commit comments

Comments
 (0)