-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add GHA release workflow (dry-run) Signed-off-by: Michal Fiedorowicz <[email protected]> * fix package name (env -> step output) Signed-off-by: Michal Fiedorowicz <[email protected]> * fix package name step Signed-off-by: Michal Fiedorowicz <[email protected]> * temporarily add pyproject.toml Signed-off-by: Michal Fiedorowicz <[email protected]> * fix short-sha output Signed-off-by: Michal Fiedorowicz <[email protected]> * fix package name step outputs Signed-off-by: Michal Fiedorowicz <[email protected]> * change workflow file ext Signed-off-by: Michal Fiedorowicz <[email protected]> * tidy up Signed-off-by: Michal Fiedorowicz <[email protected]> --------- Signed-off-by: Michal Fiedorowicz <[email protected]>
- Loading branch information
1 parent
4031782
commit edce33f
Showing
4 changed files
with
185 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
name: Release | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ release ] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }} | ||
cancel-in-progress: false | ||
|
||
env: | ||
PYTHON_RUNTIME_VERSION: "3.11" | ||
PYTHON_PACKAGE_NAME: netboxlabs-netbox-branching | ||
|
||
jobs: | ||
get-package-name: | ||
name: Get package name | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Python package name | ||
id: package-name | ||
run: echo "package-name=${{ env.PYTHON_PACKAGE_NAME }}" >> "$GITHUB_OUTPUT" | ||
outputs: | ||
package-name: ${{ steps.package-name.outputs.package-name }} | ||
get-next-version: | ||
name: Get next version | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set short sha output | ||
id: short-sha | ||
run: echo "short-sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" | ||
- name: Set release version | ||
id: release-version | ||
run: | | ||
pip install toml-cli | ||
release_version=`toml get --toml-path pyproject.toml project.version` | ||
echo "Release version: $release_version" | ||
echo "release-version=$release_version" >> "$GITHUB_OUTPUT" | ||
outputs: | ||
short-sha: ${{ steps.short-sha.outputs.short-sha }} | ||
release-version: ${{ steps.release-version.outputs.release-version }} | ||
get-release-notes: | ||
name: Get release notes | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set release notes | ||
id: release-notes | ||
env: | ||
PR_BODY: ${{ github.event.pull_request.body }} | ||
run: | | ||
echo 'release-notes<<EOF' >> $GITHUB_OUTPUT | ||
echo $PR_BODY >> $GITHUB_OUTPUT | ||
echo 'EOF' >> $GITHUB_OUTPUT | ||
outputs: | ||
release-notes: ${{ steps.release-notes.outputs.release-notes }} | ||
build: | ||
name: Build | ||
needs: [ get-package-name, get-next-version, get-release-notes ] | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
permissions: | ||
id-token: write | ||
contents: read | ||
env: | ||
BUILD_VERSION: ${{ needs.get-next-version.outputs.release-version }} | ||
BUILD_TRACK: release | ||
BUILD_COMMIT: ${{ needs.get-next-version.outputs.short-sha }} | ||
OUTPUT_FILENAME: ${{ needs.get-package-name.outputs.package-name }}-${{ needs.get-next-version.outputs.release-version }}.tar.gz | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ env.PYTHON_RUNTIME_VERSION }} | ||
- name: Build sdist package | ||
run: | | ||
python3 -m pip install --upgrade build | ||
python3 -m build --sdist --outdir dist/ | ||
- name: Replace underscores with hyphens in build filename | ||
run: | | ||
BUILD_FILENAME=$(ls dist/ | grep tar.gz) | ||
mv dist/$BUILD_FILENAME dist/${{ env.OUTPUT_FILENAME }} | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.OUTPUT_FILENAME }} | ||
path: dist/${{ env.OUTPUT_FILENAME }} | ||
retention-days: 30 | ||
if-no-files-found: error | ||
- name: Publish release distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
packages-dir: dist | ||
release: | ||
name: Release | ||
needs: [ get-next-version, get-release-notes, build ] | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Create release | ||
id: create_release | ||
uses: actions/create-release@latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ needs.get-next-version.outputs.release-version }} | ||
release_name: ${{ needs.get-next-version.outputs.release-version }} | ||
body: ${{ needs.get-release-notes.outputs.release-notes }} | ||
draft: false | ||
prerelease: false |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
[project] | ||
name = "netboxlabs-netbox-branching" | ||
version = "0.2.0" | ||
description = "A git-like branching implementation for NetBox" | ||
readme = "README.md" | ||
requires-python = ">=3.10" | ||
license = { text = "PolyForm Shield License 1.0.0" } | ||
authors = [ | ||
{ name = "NetBox Labs", email = "[email protected]" } | ||
] | ||
maintainers = [ | ||
{ name = "NetBox Labs", email = "[email protected]" } | ||
] | ||
|
||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Intended Audience :: Developers", | ||
"Topic :: Software Development :: Build Tools", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3 :: Only", | ||
'Programming Language :: Python :: 3.10', | ||
'Programming Language :: Python :: 3.11', | ||
'Programming Language :: Python :: 3.12', | ||
] | ||
|
||
dependencies = [ | ||
"Django", | ||
] | ||
|
||
[project.optional-dependencies] | ||
dev = ["black", "check-manifest", "ruff", "mkdocs", "mkdocs-material"] | ||
test = ["coverage", "pytest", "pytest-cov"] | ||
|
||
[project.urls] | ||
"Homepage" = "https://netboxlabs.com/" | ||
|
||
[project.scripts] | ||
|
||
[tool.setuptools] | ||
packages = [ | ||
"netbox_branching", | ||
] | ||
package-data = { "netbox_branching" = ["**/*", "templates/**"] } | ||
exclude-package-data = { netbox_branching = ["tests/*"] } | ||
license-files = ["LICENSE.md"] | ||
|
||
[build-system] | ||
requires = ["setuptools>=43.0.0", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.ruff] | ||
line-length = 140 | ||
|
||
[tool.ruff.format] | ||
quote-style = "double" | ||
indent-style = "space" | ||
|
||
[tool.ruff.lint] | ||
select = ["C", "D", "E", "F", "I", "R", "UP", "W"] | ||
ignore = [ | ||
"F401", | ||
"D203", | ||
"D212", | ||
"D400", | ||
"D401", | ||
"D404", | ||
"RET504", | ||
"D1" | ||
] |
This file was deleted.
Oops, something went wrong.