Skip to content

Commit

Permalink
Release Machine Stats main using tags (#210)
Browse files Browse the repository at this point in the history
* Release new version using tags on master

* Change guides

* Release libvirt using tags

* Upgrade Python action

* Change workflow trigger

* Change release new version docs
  • Loading branch information
pranavmalaviya authored Apr 22, 2022
1 parent 92b0ab2 commit 5c7208c
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 43 deletions.
43 changes: 36 additions & 7 deletions .github/workflows/pypi-upload.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: PyPI Upload

on:
push:
tags:
- '*'
release:
types: [ created ]

jobs:
machine_stats:
Expand All @@ -16,8 +15,23 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/setup-python@v3
with:
python-version: 3.8
architecture: x64

- name: Autobump version
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=${GITHUB_REF/refs\/tags\//}
PLACEHOLDER='version="develop"'
VERSION_FILE='setup.py'
# grep ensures the placeholder is there. If grep doesn't find the placeholder
# it exits with exit code 1 and github actions aborts the build.
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "s/$PLACEHOLDER/version=\"${VERSION}\"/g" "$VERSION_FILE"
- name: Install pypa/build and twine
run: |
Expand Down Expand Up @@ -54,8 +68,23 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/setup-python@v3
with:
python-version: 3.8
architecture: x64

- name: Autobump version
run: |
# from refs/tags/v1.2.3 get 1.2.3
VERSION=${GITHUB_REF/refs\/tags\//}
PLACEHOLDER='version="develop"'
VERSION_FILE='setup.py'
# grep ensures the placeholder is there. If grep doesn't find the placeholder
# it exits with exit code 1 and github actions aborts the build.
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "s/$PLACEHOLDER/version=\"${VERSION}\"/g" "$VERSION_FILE"
- name: Install pypa/build and twine
run: |
Expand Down
11 changes: 11 additions & 0 deletions libvirt/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,17 @@ We use the following tools:
1 debian10 running
```
### How to bump libvirt's version
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.
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).
* On the repo page, click on release (right side bar).
* Create new release.
* 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.
* Publish the release.
## Finally
Thanks again for your interest in improving the project! You're taking action
Expand Down
9 changes: 0 additions & 9 deletions libvirt/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
[bumpversion]
current_version = 2.2.0
commit = True
tag = True

[flake8]
ignore = E203, E266, E501, W503
max-line-length = 88
Expand All @@ -15,7 +10,3 @@ include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
line_length = 88

[bumpversion:file:setup.py]

[bumpversion:file:../unix/setup.py]
2 changes: 1 addition & 1 deletion libvirt/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="virt_stats",
version="2.5.4",
version="develop",
author="Tidal Migrations",
author_email="[email protected]",
description="A simple and effective way to gather machine statistics (RAM, Storage, CPU, etc.) from virtual environment",
Expand Down
22 changes: 6 additions & 16 deletions unix/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,14 @@ We use the following tools:

### How to bump Machine Stats version

We use [`bump2version`](https://pypi.org/project/bump2version/) to update version numbers.
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.

For example, if the current version in `1.0.0`:
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).

* `pipenv run bump2version patch` will change the version to `1.0.1`
* `pipenv run bump2version minor` will change the version to `1.1.0`
* `pipenv run bump2version major` will change the version to `2.0.0`

After that all you need to do is to run

```console
git push origin master
git push origin --tags
```

This will update the version and trigger the PyPI build and deploy.

_Note_: You can verify that the version has been updated after running the `bump2version` command by checking the `config.cfg` file. (current_version)
* On the repo page, click on release (right side bar).
* Create new release.
* 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.
* Publish the release.

### Introducing breaking changes?

Expand Down
9 changes: 0 additions & 9 deletions unix/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
[bumpversion]
commit = True
tag = True
current_version = 2.5.4

[flake8]
ignore =
E203,
Expand All @@ -24,7 +19,3 @@ include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
line_length = 88

[bumpversion:file:setup.py]

[bumpversion:file:../libvirt/setup.py]
2 changes: 1 addition & 1 deletion unix/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="machine_stats",
version="2.5.4",
version="develop",
author="Tidal Migrations",
author_email="[email protected]",
description="A simple and effective way to gather machine statistics (RAM, Storage, CPU, etc.) from server environment",
Expand Down

0 comments on commit 5c7208c

Please sign in to comment.