diff --git a/.github/workflows/pub-pypi.yml b/.github/workflows/pub-pypi.yml deleted file mode 100644 index 2b57e7c..0000000 --- a/.github/workflows/pub-pypi.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI - -on: - release: - types: [published] - -jobs: - build-n-publish: - name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@main - - name: Set up Python 3.7 - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: Install pypa/build - run: >- - python -m - pip install - build - --user - - name: Build a binary wheel and a source tarball - run: >- - python -m - build - --sdist - --wheel - --outdir dist/ - . - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/release-validation.yml b/.github/workflows/release-validation.yml new file mode 100644 index 0000000..9c243b5 --- /dev/null +++ b/.github/workflows/release-validation.yml @@ -0,0 +1,17 @@ +name: Release validation +on: + pull_request: + branches: release + types: [ opened, edited ] + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + +jobs: + release: + uses: netboxlabs/public-workflows/.github/workflows/reusable-plugin-release-validation.yml@develop + with: + plugin_package_name: netbox-bgp + plugin_package_dir: netbox_bgp + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..fedaf0e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,17 @@ +name: Release +on: + push: + branches: [ release ] + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + +jobs: + release: + uses: netboxlabs/public-workflows/.github/workflows/reusable-plugin-release.yml@develop + with: + plugin_package_name: netbox-bgp + plugin_package_dir: netbox_bgp + release_notes_from_pr_body: false + secrets: inherit diff --git a/Makefile b/Makefile index 48aecd9..7642880 100644 --- a/Makefile +++ b/Makefile @@ -51,27 +51,6 @@ pbuild: python3 -m pip install --upgrade build python3 -m build -pypipub: - python3 -m pip install --upgrade twine - python3 -m twine upload dist/* - -relpatch: - $(eval GSTATUS := $(shell git status --porcelain)) -ifneq ($(GSTATUS),) - $(error Git status is not clean. $(GSTATUS)) -endif - git checkout develop - git remote update - git pull origin develop - $(eval CURVER := $(shell cat $(VERFILE) | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')) - $(eval NEWVER := $(shell pysemver bump patch $(CURVER))) - $(eval RDATE := $(shell date '+%Y-%m-%d')) - git checkout -b release-$(NEWVER) origin/develop - echo '__version__ = "$(NEWVER)"' > $(VERFILE) - git commit -am 'bump ver' - git push origin release-$(NEWVER) - git checkout develop - test: docker-compose -f ${COMPOSE_FILE} -p ${BUILD_NAME} run netbox python manage.py test ${BUILD_NAME} diff --git a/netbox_bgp/__init__.py b/netbox_bgp/__init__.py index 6e4280f..e4e3dab 100644 --- a/netbox_bgp/__init__.py +++ b/netbox_bgp/__init__.py @@ -1,12 +1,12 @@ from netbox.plugins import PluginConfig -from .version import __version__ +from .version import version_semver class BGPConfig(PluginConfig): name = 'netbox_bgp' verbose_name = 'BGP' description = 'Subsystem for tracking bgp related objects' - version = __version__ + version = version_semver() author = 'Nikolay Yuzefovich' author_email = 'mgk.kolek@gmail.com' base_url = 'bgp' diff --git a/netbox_bgp/version.py b/netbox_bgp/version.py index 9e78220..2de2087 100644 --- a/netbox_bgp/version.py +++ b/netbox_bgp/version.py @@ -1 +1,19 @@ -__version__ = "0.14.0" +#!/usr/bin/env python +# Copyright 2024 NetBox Labs Inc +"""Version stamp.""" + +# These properties are injected at build time by the build process. + +__commit_hash__ = "unknown" +__track__ = "dev" +__version__ = "0.0.0" + + +def version_display(): + """Display the version, track and hash together.""" + return f"v{__version__}-{__track__}-{__commit_hash__}" + + +def version_semver(): + """Semantic version.""" + return __version__