Skip to content

Commit 9917de2

Browse files
authored
add release gh action (#8)
* add release gh action * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update release.yml * Update setup.py * Update release.yml * Update release.yml
1 parent be0e4a2 commit 9917de2

File tree

2 files changed

+50
-14
lines changed

2 files changed

+50
-14
lines changed

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build and publish python package
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
7+
concurrency:
8+
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
9+
cancel-in-progress: true
10+
11+
jobs:
12+
create-release:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
steps:
17+
- name: Checkout Repository
18+
uses: actions/checkout@v3
19+
with:
20+
ref: main
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Set GitHub Release Tag as Poetry Package Version
24+
run: |
25+
sed -i -r 's/version *= *".*"/version = "${{ github.event.release.tag_name }}"/g' ./netbox_atlas_plugin/__init__.py
26+
sed -i '0,/version =.*/s//version = "'"${{ github.event.release.tag_name }}"'"/' ./pyproject.toml
27+
sed -i -r 's/version*= *".*"/version="${{ github.event.release.tag_name }}"/g' ./setup.py
28+
shell: bash
29+
30+
- name: commit version to main
31+
run: |
32+
git add ./netbox_atlas_plugin/__init__.py ./pyproject.toml
33+
git config --global user.name "Github Action Release Bot"
34+
git commit -m "Change version to ${{ github.event.release.tag_name }}" --allow-empty
35+
git push origin HEAD:main
36+
shell: bash

setup.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22

33
from os import path
44
top_level_directory = path.abspath(path.dirname(__file__))
5-
with open(path.join(top_level_directory, 'README.md'), encoding='utf-8') as file:
5+
with open(path.join(top_level_directory, "README.md"), encoding="utf-8") as file:
66
long_description = file.read()
77

88
setup(
9-
name='netbox_atlas_plugin',
10-
version='1.0.2',
11-
description='A Prometheus SD API plugin for Netbox.',
9+
name="netbox_atlas_plugin",
10+
version="1.0.2",
11+
description="A Prometheus SD API plugin for Netbox.",
1212
long_description=long_description,
13-
long_description_content_type='text/markdown',
14-
author='Stefan Hipfel',
15-
author_email='[email protected]',
13+
long_description_content_type="text/markdown",
14+
author="Stefan Hipfel",
15+
author_email="[email protected]",
1616
install_requires=[],
1717
packages=find_packages(),
18-
license='Apache-2.0',
18+
license="Apache-2.0",
1919
include_package_data=True,
20-
keywords=['netbox', 'netbox-plugin', 'plugin'],
20+
keywords=["netbox", "netbox-plugin", "plugin"],
2121
classifiers=[
22-
'Development Status :: 4 - Beta',
23-
'Programming Language :: Python :: 3',
24-
'Programming Language :: Python :: 3.6',
25-
'Programming Language :: Python :: 3.7',
26-
'Programming Language :: Python :: 3.8',
22+
"Development Status :: 4 - Beta",
23+
"Programming Language :: Python :: 3",
24+
"Programming Language :: Python :: 3.6",
25+
"Programming Language :: Python :: 3.7",
26+
"Programming Language :: Python :: 3.8",
2727
],
2828
)

0 commit comments

Comments
 (0)