|
| 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 | +``` |
0 commit comments