diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index 044bc49..0000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -1,40 +0,0 @@ ---- -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Upload Python Package - -on: - release: - types: [published] - -permissions: - contents: read - -jobs: - deploy: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - - name: Build package - run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@f7600683efdcb7656dec5b29656edb7bc586e597 - 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..a0d2fc7 --- /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-acls + plugin_package_dir: netbox_acls + secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0df2a2e --- /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-acls + plugin_package_dir: netbox_acls + release_notes_from_pr_body: false + secrets: inherit diff --git a/netbox_acls/__init__.py b/netbox_acls/__init__.py index aed9081..1e78ca5 100644 --- a/netbox_acls/__init__.py +++ b/netbox_acls/__init__.py @@ -4,7 +4,7 @@ from netbox.plugins import PluginConfig -from .version import __version__ +from .version import version_semver class NetBoxACLsConfig(PluginConfig): @@ -14,7 +14,7 @@ class NetBoxACLsConfig(PluginConfig): name = "netbox_acls" verbose_name = "Access Lists" - version = __version__ + version = version_semver() description = "Manage simple ACLs in NetBox" base_url = "access-lists" min_version = "4.1.0" diff --git a/netbox_acls/version.py b/netbox_acls/version.py index 14d9d2f..4ae7b54 100644 --- a/netbox_acls/version.py +++ b/netbox_acls/version.py @@ -1 +1,18 @@ -__version__ = "1.7.0" +#!/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__