Repository navigation
v0.1.0 #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: Build the distribution | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Check out the plugin | |
| uses: actions/checkout@v7 | |
| - name: Set up Python | |
| uses: actions/setup-python@v7 | |
| with: | |
| python-version: '3.12' | |
| - name: Build | |
| run: | | |
| python -m pip install --upgrade pip build | |
| python -m build | |
| - name: Check the metadata | |
| run: | | |
| pip install twine | |
| twine check dist/* | |
| - name: Confirm the tag matches the package version | |
| if: github.event_name == 'release' | |
| run: | | |
| # A tag that disagrees with pyproject.toml publishes a version nobody expects. | |
| version=$(python -c "import tomllib,pathlib; print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])") | |
| tag="${GITHUB_REF_NAME#v}" | |
| if [ "$version" != "$tag" ]; then | |
| echo "::error::Tag $GITHUB_REF_NAME does not match project version $version" | |
| exit 1 | |
| fi | |
| - name: Upload the distribution | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish: | |
| name: Publish to PyPI | |
| needs: build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| # Trusted publishing: PyPI verifies this workflow's identity, so no API token is stored | |
| # in the repository. Configure it once at | |
| # https://pypi.org/manage/project/netbox-change-control/settings/publishing/ | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/netbox-change-control | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download the distribution | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish | |
| uses: pypa/gh-action-pypi-publish@release/v1 |