Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding pontos ... #24

Merged
merged 8 commits into from
Sep 3, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]

### Added
* Adding pontos module for future releases [#24](https://github.com/greenbone/autohooks-plugin-pylint/pull/24)
y0urself marked this conversation as resolved.
Show resolved Hide resolved

### Changed

* Replaced pipenv with poetry for dependency management. poetry install works a bit different than pipenv install. It installs dev packages. [#16](https://github.com/greenbone/autohooks-plugin-pylint/pull/16)
Expand Down
152 changes: 87 additions & 65 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,29 @@ Before creating a new release please do a careful consideration about the
version number for the new release. We are following [Semantic Versioning](https://semver.org/)
bjoernricks marked this conversation as resolved.
Show resolved Hide resolved
and [PEP440](https://www.python.org/dev/peps/pep-0440/).

* Install development dependencies
## Preparing the Required Python Packages

```sh
pipenv install --dev
```

* Fetch upstream changes and create release branch
* Install development dependencies

```sh
git fetch upstream
git checkout -b create-new-release upstream/master
poetry install
```

* Open [setup.py](setup.py) and increment the version number

* Update [CHANGELOG](CHANGELOG.md) and set release version, date and link to diff

* Create distribution files
* Install twine for pypi package uploads

```sh
rm -rf dist build autohooks_plugin_pylint.egg-info
python3 setup.py sdist bdist_wheel
python3 -m pip install --user --upgrade twine
```

* Create a git commit

```sh
git add .
git commit -m "Prepare release <version>"
```
## Configuring the Access to the Python Package Index (PyPI)

* Create a `.pypirc` file
*Note:* This is only necessary for users performing the release process for the
first time.

```sh
vim ~/.pypirc
```
* Create an account at [Test PyPI](https://packaging.python.org/guides/using-testpypi/).

with the following content (Note: `<username>` must be replaced)
* Create a pypi configuration file `~/.pypirc` with the following content (Note:
`<username>` must be replaced):

```ini
[distutils]
Expand All @@ -55,89 +40,126 @@ and [PEP440](https://www.python.org/dev/peps/pep-0440/).
[testpypi]
repository = https://test.pypi.org/legacy/
username = <username>
```

* If necessary, create an account at [Test PyPI](https://packaging.python.org/guides/using-testpypi/)
## Create a GitHub Token for uploading the release files

This step is only necessary if the token has to be created for the for time or
if it has been lost.

* Upload the archives in dist to [Test PyPI](https://test.pypi.org/)
* Open Github Settings at https://github.com/settings/tokens
* Create a new token
* Copy token and store it carefully
* Export token in your current shell

```sh
twine upload -r testpypi dist/*
export GITHUB_TOKEN=<token>
export GITHUB_USER=<name>
```

* Check if the package is available at https://test.pypi.org/project/autohooks-plugin-pylint
## Prepare testing the to be released version

* Create a test directory
* Fetch upstream changes

```sh
mkdir autohooks-install-test
cd autohooks-install-test
pipenv run pip install --pre -I --extra-index-url https://test.pypi.org/simple/ autohooks-plugin-pylint
git remote add upstream git@github.com:greenbone/autohooks-plugin-pylint.git
git fetch upstream
git rebase update/master
```

* Remove test environment
* Get the current version number

```sh
pipenv --rm
cd ..
rm -rf autohooks-install-test
poetry run python -m pontos.version show
```

* Create a release PR
* Update the version number to some alpha version e.g.

```sh
git push origin
poetry run python -m pontos.version update 2.2.3a1
```
Open GitHub and create a PR against https://github.com/greenbone/autohooks-plugin-pylint

* Update after PR is merged
## Uploading to the PyPI Test Instance

* Create a source and wheel distribution:

```sh
git fetch upstream
git rebase upstream/master
rm -rf dist build autohooks-plugin-pylint.egg-info pip-wheel-metadata
poetry build
```
* Create a git tag

* Upload the archives in `dist` to [Test PyPI](https://test.pypi.org/):

```sh
git tag v<version>
twine upload -r testpypi dist/*
```

or even signed with your gpg key
* Check if the package is available at <https://test.pypi.org/project/autohooks-plugin-pylint>

* Create a test directory

```sh
git tag -s v<version>
mkdir autohooks-plugin-pylint-install-test
cd autohooks-plugin-pylint-install-test
git init
python3 -m venv test-env
source ./test-env/bin/activate
pip install -U pip # ensure the environment uses a recent version of pip
pip install --pre -I --extra-index-url https://test.pypi.org/simple/ autohooks-plugin-pylint
python -c "from autohooks-plugin-pylint.__version__ import __version__; print(__version__)"
autohooks-plugin-pylint check
```
* Create final distribution files

* Remove test environment

```sh
rm -rf dist build autohooks_plugin_pylint.egg-info
python3 setup.py sdist bdist_wheel
deactivate
cd ..
rm -rf autohooks-plugin-pylint-install-test
```

* If necessary, create an account at [PyPI](https://pypi.org/)
## Prepare the Release

* Upload to the real [PyPI](https://pypi.org/)
* Run pontos-release prepare

```sh
twine upload dist/*
poetry run pontos-release --release-version <version> --next-release-version <dev-version> --project autohooks-plugin-pylint --space greenbone --git-signing-key <your-public-gpg-key> --git-remote-name upstream prepare
```

* Check if new version is available at https://pypi.org/project/autohooks-plugin-pylint
* Check git log and tag

* Update version in [setup.py](setup.py)
```
git log -p

Use a alpha version like `(1, 1, 1, 'alpha')` or
`(1, 1, 1, 'alpha', 0)`
# is the changelog correct?
# does the version look right?
# does the tag point to the correct commit?
```

* Create a commit
* If something did go wrong delete the tag, revert the commits and remove the
temporary file for the release changelog

```sh
git add setup.py
git commit -m "Update version after <version> release"
```
git tag -d v<version>
git reset <last-commit-id-before-running-pontos-release> --hard
rm .release.txt.md
```

* Push changes and tag to GitHub
## Create the Release

* Run pontos-release release

```sh
git push --tags upstream master
poetry run pontos-release --release-version <version> --next-release-version <dev-version> --project autohooks-plugin-pylint --space greenbone --git-signing-key <your-public-gpg-key> --git-remote-name upstream release
```

## Uploading to the 'real' PyPI

* Uploading to PyPI is done automatically by pushing a git tag via CircleCI

* Check if new version is available at <https://pypi.org/project/autohooks-plugin-pylint>

## Check the Release

* Check the Github release:

See https://github.com/greenbone/autohooks-plugin-pylint/releases
5 changes: 5 additions & 0 deletions autohooks/plugins/pylint/__version__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# pylint: disable=invalid-name

# THIS IS AN AUTOGENERATED FILE. DO NOT TOUCH!

__version__ = "20.9.0.dev1"
Loading