-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (110 loc) · 3.69 KB
/
version.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
---
# Note: This will run every time that a new release is published because of
# `on`. Releasing can be controller through the github CLI like
#
name: Version.
on:
workflow_dispatch:
inputs:
kind:
default: patch
required: true
description: |
Segment of the version to increment. A value of `tag` indicates
that only the tag should be updated.
options:
- tag
- patch
- minor
- major
kind_tag:
default: alpha
required: true
description: |
Tag of the new version. Cannot go backwards, ordered like
``final > beta > alpha``. ``final`` indicates no tag.
options:
- final
- alpha
- beta
tag_message:
required: true
description: |
Tag message an release body.
jobs:
bumpver:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout.
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Ensure Python is Installed.
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Cache Pip
uses: actions/cache@v3
id: bumpver-venv
with:
path: .venv
key: ${{ runner.os }}-venv-release
- name: Install Dependencies.
id: bumpver-depends
run: |
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install poetry twine bumpver
# NOTE: This will not be published so it is fine that it happens at this
# stage.
- name: Build and Verify.
id: bumpver-build-and-verify
run: |
source .venv/bin/activate
echo "## Build\n\n~~~stdout" >> $GITHUB_STEP_SUMMARY
poetry build >> $GITHUB_STEP_SUMMARY
echo "~~~\n\n## Twine Check\n\n~~~stdout" >> $GITHUB_STEP_SUMMARY
python3 -m twine check dist/* >> $GITHUB_STEP_SUMMARY
echo "~~~" >> $GITHUB_STEP_SUMMARY
# NOTE: Poetry does have versioning capabilities however they do not
# appear to have much of an advantage over bumpver.
- name: Increment Version.
id: bumpver-update
run: |
source .venv/bin/activate
echo "## Bumpver Data\n\n" >> $GITHUB_STEP_SUMMARY
echo "- kind: ${{ github.event.inputs.kind }}" >> $GITHUB_STEP_SUMMARY
echo "- kind_tag: ${{ github.event.inputs.kind_tag }}" >> $GITHUB_STEP_SUMMARY
git config user.name "github-actions"
git config user.email "<>"
if [[ "${{ github.event.inputs.kind}}" == "tag" ]];
then
python -m bumpver update \
--tag "${{ github.event.inputs.kind_tag }}" \
--tag-message "${{ github.event.inputs.tag_message }}" \
--commit
else
python -m bumpver update "--${{ github.event.inputs.kind }}" \
--tag "${{ github.event.inputs.kind_tag }}" \
--tag-message "${{ github.event.inputs.tag_message }}" \
--commit
fi
git push
git push --tags
# NOTE: This will be done in the ``captura-deploy`` repository. Making a PR
# here should trigger that pipeline.
# dockerhub:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout.
# uses: actions/checkout@v4
# with:
# fetch-depth: 0
#
# - name: Log in to Docker Hub.
# uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}