Skip to content

Commit bc00146

Browse files
committed
Documenting the git hub flow workflow
1 parent 5510a30 commit bc00146

File tree

7 files changed

+87
-7
lines changed

7 files changed

+87
-7
lines changed
Loading
Loading
Loading
Loading

docs/input/docs/learn/branching-strategies/gitflow/examples.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ iterations. Release branches are taken from `main` (or from `develop`) and will
8686
be merged back afterwards. Finally the `main` branch is tagged with the
8787
released version.
8888

89+
Release branches can be used in the `GitFlow` as well as `GitHubFlow` workflow.
90+
Sometimes you
91+
want to start on a large feature which may take a while to stabilize so you want
92+
to keep it off main. In these scenarios you can either create a long lived
93+
feature branch (if you do not know the version number this large feature will go
94+
into, and it's non-breaking) otherwise you can create a release branch for the
95+
next major version. You can then submit pull requests to the long lived feature
96+
branch or the release branch.
97+
8998
### Create release branch
9099

91100
![GitFlow](/docs/img/DocumentationSamplesForGitFlow\_ReleaseBranch.png)

docs/input/docs/learn/branching-strategies/githubflow/examples.md

Lines changed: 72 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,87 @@ Title: GitHubFlow Examples
44
RedirectFrom: docs/git-branching-strategies/githubflow-examples
55
---
66

7-
## Feature branch
7+
These examples are illustrating the usage of the supported `GitHubFlow` workflow
8+
in GitVersion. To enable this workflow, the builtin template
9+
[GitHubFlow/v1](/docs/workflows/GitHubFlow/v1.json) needs to be referenced in the
10+
configuration as follows:
11+
```yaml
12+
workflow: GitHubFlow/v1
13+
mode: ContinuousDelivery
14+
```
815
9-
![GitHubFlow](/docs/img/githubflow_feature-branch.png)
16+
Where
17+
the [continuous deployment][continuous-deployment] mode for no branches,
18+
the [continuous delivery][continuous-delivery] mode for
19+
`main` branch and
20+
the [manual deployment][manual-deployment] mode
21+
for `release`, `feature` and `unknown` branches are specified.
1022

11-
## Pull requests
23+
This configuration allows you to publish CI (Continuous Integration) builds
24+
from `main` branch to an artifact repository.
25+
All other branches are manually published. Read more about this at
26+
[version increments](/docs/reference/version-increments).
1227

13-
![GitHubFlow](/docs/img/githubflow_pull-request.png)
28+
:::{.alert .alert-info}
29+
The _continuous delivery_ mode has been used for the `main` branch in this
30+
examples (specified as a fallback on the root
31+
configuration layer) to illustrate how the version increments are applied.
32+
In production context the _continuous deployment_ mode might be a better
33+
option when e.g. the release process is automated or the commits are tagged
34+
by the pipeline automatically.
35+
:::
1436

15-
## Release branch
37+
## Feature Branch
1638

17-
Release branches can be used in GitHubFlow as well as GitFlow. Sometimes you
39+
Feature branches can be used in the `GitHubFlow` workflow to implement a
40+
feature or fix a bug in an isolated environment. Feature branches will take
41+
the feature
42+
branch name and use that as the pre-release label. Feature branches will be
43+
created from a `main` or `release` branch.
44+
45+
### Create feature branch from main
46+
47+
![GitHubFlow](/docs/img/DocumentationSamplesForGitHubFlow_FeatureBranch.png)
48+
49+
:::{.alert .alert-info}
50+
After the feature branch is merged, the version on `main` is `2.0.0-5`.
51+
This is due to `main` running in _continuous delivery_ mode. If `main` was
52+
configured to use _continuous deployment_ the version would be `2.0.0`.
53+
:::
54+
55+
## Release Branches
56+
57+
Release branches are used for major and minor releases to stabilize a RC
58+
(Release Candidate) or to integrate features (in parallel) targeting different
59+
iterations. Release branches are taken from `main` and will
60+
be merged back afterwards. Finally the `main` branch is tagged with the
61+
released version.
62+
63+
Release branches can be used in the `GitHubFlow` as well as `GitFlow` workflow.
64+
Sometimes you
1865
want to start on a large feature which may take a while to stabilize so you want
1966
to keep it off main. In these scenarios you can either create a long lived
2067
feature branch (if you do not know the version number this large feature will go
2168
into, and it's non-breaking) otherwise you can create a release branch for the
2269
next major version. You can then submit pull requests to the long lived feature
2370
branch or the release branch.
2471

25-
![GitFlow](/docs/img/githubflow_release-branch.png)
72+
### Create release branch
73+
74+
![GitFlow](/docs/img/DocumentationSamplesForGitHubFlow_ReleaseBranch.png)
75+
76+
### Create release branch with version
77+
78+
![GitFlow](/docs/img/DocumentationSamplesForGitHubFlow_VersionedReleaseBranch.png)
79+
80+
## To Contribute
81+
82+
See [contributing examples](/docs/learn/branching-strategies/contribute-examples).
83+
84+
### Source
85+
86+
See `DocumentationSamplesForGitHubFlow.cs`. To update, modify then run test.
87+
88+
[continuous-deployment]: /docs/reference/modes/continuous-deployment
89+
[continuous-delivery]: /docs/reference/modes/continuous-delivery
90+
[manual-deployment]: /docs/reference/modes/manual-deployment

src/GitVersion.Core.Tests/IntegrationTests/DocumentationSamplesForGitHubFlow.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public void FeatureBranch(bool withPullRequestIntoMain)
7575
fixture.SequenceDiagram.Activate("main");
7676
fixture.MakeACommit();
7777
fixture.AssertFullSemver("2.0.0-6", configuration);
78+
fixture.ApplyTag("2.0.0");
79+
fixture.AssertFullSemver("2.0.0", configuration);
7880
}
7981

8082
[TestCase(false)]
@@ -216,6 +218,8 @@ public void ReleaseBranch(bool withPullRequestIntoMain)
216218
fixture.SequenceDiagram.Activate("main");
217219
fixture.MakeACommit();
218220
fixture.AssertFullSemver("1.3.1-6", configuration);
221+
fixture.ApplyTag("1.3.1");
222+
fixture.AssertFullSemver("1.3.1", configuration);
219223
}
220224

221225
[TestCase(false)]
@@ -357,6 +361,8 @@ public void VersionedReleaseBranch(bool withPullRequestIntoMain)
357361
fixture.SequenceDiagram.Activate("main");
358362
fixture.MakeACommit();
359363
fixture.AssertFullSemver("2.3.1-6", configuration);
364+
fixture.ApplyTag("2.3.1");
365+
fixture.AssertFullSemver("2.3.1", configuration);
360366
}
361367

362368
[TestCase(false)]

0 commit comments

Comments
 (0)