1
1
name : Release_Workflow
2
+
2
3
on :
3
4
push :
4
5
branches :
5
6
- master
7
+
6
8
jobs :
7
9
Code_Analysis_Job :
8
10
runs-on : ubuntu-latest
9
11
environment : test
10
12
steps :
11
- -
12
- name : Check out repository code
13
+ - name : Check out repository code
13
14
uses : actions/checkout@v4
14
- -
15
- name : Setup Python environment
15
+
16
+ - name : Setup Python environment
16
17
uses : actions/setup-python@v5
17
- -
18
- name : Install Dependencies
18
+
19
+ - name : Install Dependencies
19
20
run : pip install requests
20
- -
21
- name : Install Package
21
+
22
+ - name : Install Package
22
23
run : pip install -e .
23
- -
24
- name : Running acceptace test
24
+
25
+ - name : Running acceptance test
25
26
run : python test.py
26
27
env :
27
28
ULTRADNS_UNIT_TEST_USERNAME : ${{ secrets.ULTRADNS_UNIT_TEST_USERNAME }}
@@ -33,41 +34,59 @@ jobs:
33
34
needs : Code_Analysis_Job
34
35
environment : prod
35
36
steps :
36
- -
37
- name : Check out repository code
37
+ - name : Check out repository code
38
38
uses : actions/checkout@v4
39
- -
40
- name : Setup Python environment
39
+
40
+ - name : Setup Python environment
41
41
uses : actions/setup-python@v5
42
- -
43
- name : Create Release Info
42
+
43
+ - name : Create Release Info
44
44
run : |
45
45
PLAIN_VERSION=$(cat .plugin-version | sed 's/^v//')
46
46
echo "RELEASE_VERSION=$(cat .plugin-version)" >> $GITHUB_ENV
47
47
echo "PLAIN_VERSION=$PLAIN_VERSION" >> $GITHUB_ENV
48
- -
49
- name : Debug Versions
48
+
49
+ - name : Debug Versions
50
50
run : |
51
51
echo "Tag version: ${{ env.RELEASE_VERSION }}"
52
52
echo "Hatch version: ${{ env.PLAIN_VERSION }}"
53
- -
54
- name : Installing Dependencies
53
+
54
+ - name : Installing Dependencies
55
55
run : |
56
56
pip install requests
57
57
pip install hatch
58
- -
59
- name : Versioning the build
60
- run : hatch version ${{ env.PLAIN_VERSION }}
61
- -
62
- name : Creating python Package
58
+
59
+ - name : Ensure Correct Version in about.py
60
+ run : |
61
+ if grep -q '__version__' src/ultra_rest_client/about.py; then
62
+ sed -i 's/^__version__ = .*/__version__ = "'"${{ env.PLAIN_VERSION }}"'"/' src/ultra_rest_client/about.py
63
+ else
64
+ echo "__version__ = \"${{ env.PLAIN_VERSION }}\"" > src/ultra_rest_client/about.py
65
+ fi
66
+ cat src/ultra_rest_client/about.py
67
+
68
+ - name : Check Hatch Version and Update if Necessary
69
+ run : |
70
+ CURRENT_VERSION=$(hatch version)
71
+ echo "Current Hatch version: $CURRENT_VERSION"
72
+ echo "PLAIN_VERSION: ${{ env.PLAIN_VERSION }}"
73
+
74
+ if [ "$CURRENT_VERSION" != "${{ env.PLAIN_VERSION }}" ]; then
75
+ echo "Updating version..."
76
+ hatch version "${{ env.PLAIN_VERSION }}"
77
+ else
78
+ echo "Skipping version update. Already set to ${{ env.PLAIN_VERSION }}"
79
+ fi
80
+
81
+ - name : Creating Python Package
63
82
run : hatch build
64
- -
65
- name : create release Tag
83
+
84
+ - name : Create release tag
66
85
run : |
67
86
git tag ${{ env.RELEASE_VERSION }}
68
87
git push origin ${{ env.RELEASE_VERSION }}
69
- -
70
- name : Publishing python Package
88
+
89
+ - name : Publishing python Package
71
90
72
91
with :
73
92
password : ${{ secrets.PYPI_API_TOKEN }}
0 commit comments