diff --git a/.github/workflows/pub-pypi.yml b/.github/workflows/pub-pypi.yml deleted file mode 100644 index c016a37..0000000 --- a/.github/workflows/pub-pypi.yml +++ /dev/null @@ -1,36 +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 - environment: release - permissions: - id-token: write - contents: read - 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 diff --git a/.github/workflows/release-validation.yaml b/.github/workflows/release-validation.yaml new file mode 100644 index 0000000..973e783 --- /dev/null +++ b/.github/workflows/release-validation.yaml @@ -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-floorplan-plugin + plugin_package_dir: netbox_floorplan + secrets: inherit diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..6cb1936 --- /dev/null +++ b/.github/workflows/release.yaml @@ -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-floorplan-plugin + plugin_package_dir: netbox_floorplan + release_notes_from_pr_body: false + secrets: inherit diff --git a/netbox_floorplan/__init__.py b/netbox_floorplan/__init__.py index 9ae55ab..ff0e0d5 100644 --- a/netbox_floorplan/__init__.py +++ b/netbox_floorplan/__init__.py @@ -1,4 +1,5 @@ from netbox.plugins import PluginConfig +from .version import version_semver class FloorplanConfig(PluginConfig): @@ -6,7 +7,7 @@ class FloorplanConfig(PluginConfig): name = "netbox_floorplan" verbose_name = "Netbox Floorplan" description = "" - version = "0.4.1" + version = version_semver() base_url = "floorplan" min_version = "4.0.2" max_version = "4.0.11" diff --git a/netbox_floorplan/version.py b/netbox_floorplan/version.py index 3d26edf..4ae7b54 100644 --- a/netbox_floorplan/version.py +++ b/netbox_floorplan/version.py @@ -1 +1,18 @@ -__version__ = "0.4.1" +#!/usr/bin/env python +"""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__