Skip to content

Commit 5c7208c

Browse files
Release Machine Stats main using tags (#210)
* Release new version using tags on master * Change guides * Release libvirt using tags * Upgrade Python action * Change workflow trigger * Change release new version docs
1 parent 92b0ab2 commit 5c7208c

File tree

7 files changed

+55
-43
lines changed

7 files changed

+55
-43
lines changed

.github/workflows/pypi-upload.yml

+36-7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: PyPI Upload
22

33
on:
4-
push:
5-
tags:
6-
- '*'
4+
release:
5+
types: [ created ]
76

87
jobs:
98
machine_stats:
@@ -16,8 +15,23 @@ jobs:
1615
steps:
1716
- uses: actions/checkout@v2
1817

19-
- name: Set up Python
20-
uses: actions/setup-python@v2
18+
- uses: actions/setup-python@v3
19+
with:
20+
python-version: 3.8
21+
architecture: x64
22+
23+
- name: Autobump version
24+
run: |
25+
# from refs/tags/v1.2.3 get 1.2.3
26+
VERSION=${GITHUB_REF/refs\/tags\//}
27+
PLACEHOLDER='version="develop"'
28+
VERSION_FILE='setup.py'
29+
30+
# grep ensures the placeholder is there. If grep doesn't find the placeholder
31+
# it exits with exit code 1 and github actions aborts the build.
32+
grep "$PLACEHOLDER" "$VERSION_FILE"
33+
34+
sed -i "s/$PLACEHOLDER/version=\"${VERSION}\"/g" "$VERSION_FILE"
2135
2236
- name: Install pypa/build and twine
2337
run: |
@@ -54,8 +68,23 @@ jobs:
5468
steps:
5569
- uses: actions/checkout@v2
5670

57-
- name: Set up Python
58-
uses: actions/setup-python@v2
71+
- uses: actions/setup-python@v3
72+
with:
73+
python-version: 3.8
74+
architecture: x64
75+
76+
- name: Autobump version
77+
run: |
78+
# from refs/tags/v1.2.3 get 1.2.3
79+
VERSION=${GITHUB_REF/refs\/tags\//}
80+
PLACEHOLDER='version="develop"'
81+
VERSION_FILE='setup.py'
82+
83+
# grep ensures the placeholder is there. If grep doesn't find the placeholder
84+
# it exits with exit code 1 and github actions aborts the build.
85+
grep "$PLACEHOLDER" "$VERSION_FILE"
86+
87+
sed -i "s/$PLACEHOLDER/version=\"${VERSION}\"/g" "$VERSION_FILE"
5988
6089
- name: Install pypa/build and twine
6190
run: |

libvirt/CONTRIBUTING.md

+11
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ We use the following tools:
8383
1 debian10 running
8484
```
8585
86+
### How to bump libvirt's version
87+
88+
We use tags to release a new version of libvirt. To make a new release, simply create a tag on the `master` branch and the `pypi-upload` GitHub Workflow will take care of the rest.
89+
90+
To build a new image, you will need to create a release. The steps are pretty simple, You can find Github's instruction [here](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release).
91+
92+
* On the repo page, click on release (right side bar).
93+
* Create new release.
94+
* Choose a tag. You should create a new tag for your build. Make sure that you've selected the `master` branch as your target branch.
95+
* Publish the release.
96+
8697
## Finally
8798
8899
Thanks again for your interest in improving the project! You're taking action

libvirt/setup.cfg

-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
[bumpversion]
2-
current_version = 2.2.0
3-
commit = True
4-
tag = True
5-
61
[flake8]
72
ignore = E203, E266, E501, W503
83
max-line-length = 88
@@ -15,7 +10,3 @@ include_trailing_comma = True
1510
force_grid_wrap = 0
1611
use_parentheses = True
1712
line_length = 88
18-
19-
[bumpversion:file:setup.py]
20-
21-
[bumpversion:file:../unix/setup.py]

libvirt/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="virt_stats",
8-
version="2.5.4",
8+
version="develop",
99
author="Tidal Migrations",
1010
author_email="support@tidalmigrations.com",
1111
description="A simple and effective way to gather machine statistics (RAM, Storage, CPU, etc.) from virtual environment",

unix/CONTRIBUTING.md

+6-16
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,14 @@ We use the following tools:
4545

4646
### How to bump Machine Stats version
4747

48-
We use [`bump2version`](https://pypi.org/project/bump2version/) to update version numbers.
48+
We use tags to release a new version of machine stats. To make a new release, simply create a tag on the `master` branch and the `pypi-upload` GitHub Workflow will take care of the rest.
4949

50-
For example, if the current version in `1.0.0`:
50+
To build a new image, you will need to create a release. The steps are pretty simple, You can find Github's instruction [here](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release).
5151

52-
* `pipenv run bump2version patch` will change the version to `1.0.1`
53-
* `pipenv run bump2version minor` will change the version to `1.1.0`
54-
* `pipenv run bump2version major` will change the version to `2.0.0`
55-
56-
After that all you need to do is to run
57-
58-
```console
59-
git push origin master
60-
git push origin --tags
61-
```
62-
63-
This will update the version and trigger the PyPI build and deploy.
64-
65-
_Note_: You can verify that the version has been updated after running the `bump2version` command by checking the `config.cfg` file. (current_version)
52+
* On the repo page, click on release (right side bar).
53+
* Create new release.
54+
* Choose a tag. You should create a new tag for your build. Make sure that you've selected the `master` branch as your target branch.
55+
* Publish the release.
6656

6757
### Introducing breaking changes?
6858

unix/setup.cfg

-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
[bumpversion]
2-
commit = True
3-
tag = True
4-
current_version = 2.5.4
5-
61
[flake8]
72
ignore =
83
E203,
@@ -24,7 +19,3 @@ include_trailing_comma = True
2419
force_grid_wrap = 0
2520
use_parentheses = True
2621
line_length = 88
27-
28-
[bumpversion:file:setup.py]
29-
30-
[bumpversion:file:../libvirt/setup.py]

unix/setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="machine_stats",
8-
version="2.5.4",
8+
version="develop",
99
author="Tidal Migrations",
1010
author_email="support@tidalmigrations.com",
1111
description="A simple and effective way to gather machine statistics (RAM, Storage, CPU, etc.) from server environment",

0 commit comments

Comments
 (0)