Skip to content

Commit 38f133b

Browse files
PsypherPunkLee-W
authored andcommitted
docs: add developmental releases tutorial
1 parent d905f7e commit 38f133b

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

docs/tutorials/dev_releases.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Dev Releases
2+
3+
## About
4+
5+
To make use of a `.dev` suffix, as per
6+
[PEP440](https://peps.python.org/pep-0440/#developmental-releases).
7+
8+
If more than one active branch attempts to create a tag, relative to the main
9+
branch, there is the possibility that each will attempt to create the _same_
10+
tag, resulting in a collision.
11+
12+
Developmental releases aim to avoid this by including a `.dev` segment which
13+
includes a non-negative integer unique to that workflow:
14+
15+
```txt
16+
X.Y.devN
17+
```
18+
19+
!!! note
20+
As noted in
21+
[PEP440](https://peps.python.org/pep-0440/#developmental-releases),
22+
although developmental releases are useful in avoiding the situation
23+
described above, depending on the value passed as the developmental
24+
release, they can be _"difficult to parse for human readers"_.
25+
26+
## How to
27+
28+
### Example 1: CircleCI
29+
30+
For example, CircleCI [provides](https://circleci.com/docs/variables/)
31+
`CIRCLE_BUILD_NUM`, a unique number for each job which will increment with each
32+
run:
33+
34+
```sh
35+
--devrelease ${CIRCLE_BUILD_NUM}
36+
```
37+
38+
This will result in a unique developmental release of, for example:
39+
40+
```sh
41+
1.3.2.dev2478
42+
```
43+
44+
### Example 2: GitHub
45+
46+
GitHub also
47+
[provides](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables)
48+
`GITHUB_RUN_ID`, a _"unique number for each workflow run"_ which will also
49+
provide a unique number for each workflow:
50+
51+
```sh
52+
--devrelease ${GITHUB_RUN_ID}
53+
```
54+
55+
This will result in a unique developmental release of, for example:
56+
57+
```sh
58+
1.3.2.dev6048584598
59+
```
60+
61+
### Example 3: Unix time
62+
63+
Equally, as the developmental release needs only a non-negative integer, it is
64+
possible to use the Unix time (i.e. the number of seconds since 1st January
65+
1970 UTC).
66+
67+
This would create the possibility of a collision if two builds occur at
68+
precisely the same second but this may be sufficient for many cases:
69+
70+
```sh
71+
--devrelease $(date +%s)
72+
```
73+
74+
This will result in a unique developmental release of, for example:
75+
76+
```sh
77+
1.3.2.dev1696238452
78+
```

mkdocs.yml

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ nav:
4747
- GitLab CI: "tutorials/gitlab_ci.md"
4848
- Github Actions: "tutorials/github_actions.md"
4949
- Jenkins pipeline: "tutorials/jenkins_pipeline.md"
50+
- Developmental releases: "tutorials/dev_releases.md"
5051
- FAQ: "faq.md"
5152
- Exit Codes: "exit_codes.md"
5253
- Third-Party Commitizen Templates: "third-party-commitizen.md"

0 commit comments

Comments
 (0)