dbus2mqtt 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. dbus2mqtt-0.6.0/.dockerignore +14 -0
  2. dbus2mqtt-0.6.0/.env.example +4 -0
  3. dbus2mqtt-0.6.0/.github/ISSUE_TEMPLATE/bug_report.md +41 -0
  4. dbus2mqtt-0.6.0/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  5. dbus2mqtt-0.6.0/.github/release-drafter.yml +51 -0
  6. dbus2mqtt-0.6.0/.github/scripts/release-versions.py +66 -0
  7. dbus2mqtt-0.6.0/.github/workflows/ci.yml +41 -0
  8. dbus2mqtt-0.6.0/.github/workflows/deploy-docs.yml +29 -0
  9. dbus2mqtt-0.6.0/.github/workflows/docker-dev.yml +81 -0
  10. dbus2mqtt-0.6.0/.github/workflows/docker-stable.yml +101 -0
  11. dbus2mqtt-0.6.0/.github/workflows/pre-commit.yml +31 -0
  12. dbus2mqtt-0.6.0/.github/workflows/publish.yml +57 -0
  13. dbus2mqtt-0.6.0/.github/workflows/release-drafter.yml +26 -0
  14. dbus2mqtt-0.6.0/.github/workflows/trivy.yml +35 -0
  15. dbus2mqtt-0.6.0/.github/workflows/uv-lock-report.yml +25 -0
  16. dbus2mqtt-0.6.0/.gitignore +23 -0
  17. dbus2mqtt-0.6.0/.markdownlint.json +5 -0
  18. dbus2mqtt-0.6.0/.pre-commit-config.yaml +78 -0
  19. dbus2mqtt-0.6.0/.python-version +1 -0
  20. dbus2mqtt-0.6.0/.vscode/launch.json +21 -0
  21. dbus2mqtt-0.6.0/.vscode/settings.json +16 -0
  22. dbus2mqtt-0.6.0/.yamllint.yml +4 -0
  23. dbus2mqtt-0.6.0/LICENSE +21 -0
  24. dbus2mqtt-0.6.0/PKG-INFO +125 -0
  25. dbus2mqtt-0.6.0/README.md +91 -0
  26. dbus2mqtt-0.6.0/docker/Dockerfile.dev +41 -0
  27. dbus2mqtt-0.6.0/docker/Dockerfile.pypi +12 -0
  28. dbus2mqtt-0.6.0/docs/assets/favicon.svg +22 -0
  29. dbus2mqtt-0.6.0/docs/assets/logo-dark-img.svg +11 -0
  30. dbus2mqtt-0.6.0/docs/assets/logo-dark-text.png +0 -0
  31. dbus2mqtt-0.6.0/docs/assets/logo-dark-text.svg +22 -0
  32. dbus2mqtt-0.6.0/docs/assets/logo-light-img.svg +11 -0
  33. dbus2mqtt-0.6.0/docs/assets/logo-light-text.svg +22 -0
  34. dbus2mqtt-0.6.0/docs/developer/debugging_dbus.md +21 -0
  35. dbus2mqtt-0.6.0/docs/developer/index.md +56 -0
  36. dbus2mqtt-0.6.0/docs/examples/bluez.md +44 -0
  37. dbus2mqtt-0.6.0/docs/examples/bluez.yaml +86 -0
  38. dbus2mqtt-0.6.0/docs/examples/connman-config.md +20 -0
  39. dbus2mqtt-0.6.0/docs/examples/connman-config.yaml +186 -0
  40. dbus2mqtt-0.6.0/docs/examples/dbus2mqtt_internal_state.md +24 -0
  41. dbus2mqtt-0.6.0/docs/examples/dbus2mqtt_internal_state.yaml +47 -0
  42. dbus2mqtt-0.6.0/docs/examples/home_assistant_media_player/mqtt_mediaplayer.yaml +89 -0
  43. dbus2mqtt-0.6.0/docs/examples/home_assistant_media_player.md +84 -0
  44. dbus2mqtt-0.6.0/docs/examples/home_assistant_media_player.yaml +173 -0
  45. dbus2mqtt-0.6.0/docs/examples/index.md +9 -0
  46. dbus2mqtt-0.6.0/docs/examples/linux_desktop/notify.json +13 -0
  47. dbus2mqtt-0.6.0/docs/examples/linux_desktop/notify_with_actions_and_hints.json +13 -0
  48. dbus2mqtt-0.6.0/docs/examples/linux_desktop.md +56 -0
  49. dbus2mqtt-0.6.0/docs/examples/linux_desktop.yaml +62 -0
  50. dbus2mqtt-0.6.0/docs/flows/flow_actions.md +42 -0
  51. dbus2mqtt-0.6.0/docs/flows/flow_triggers.md +141 -0
  52. dbus2mqtt-0.6.0/docs/flows/index.md +71 -0
  53. dbus2mqtt-0.6.0/docs/hooks.py +16 -0
  54. dbus2mqtt-0.6.0/docs/index.md +2 -0
  55. dbus2mqtt-0.6.0/docs/overrides/main.html +8 -0
  56. dbus2mqtt-0.6.0/docs/setup.md +80 -0
  57. dbus2mqtt-0.6.0/docs/stylesheets/extra.css +4 -0
  58. dbus2mqtt-0.6.0/docs/subscriptions.md +199 -0
  59. dbus2mqtt-0.6.0/docs/templating/index.md +48 -0
  60. dbus2mqtt-0.6.0/mkdocs.yml +153 -0
  61. dbus2mqtt-0.6.0/pyproject.toml +138 -0
  62. dbus2mqtt-0.6.0/renovate.json +70 -0
  63. dbus2mqtt-0.6.0/src/dbus2mqtt/__init__.py +10 -0
  64. dbus2mqtt-0.6.0/src/dbus2mqtt/__main__.py +4 -0
  65. dbus2mqtt-0.6.0/src/dbus2mqtt/config/__init__.py +209 -0
  66. dbus2mqtt-0.6.0/src/dbus2mqtt/config/jsonarparse.py +38 -0
  67. dbus2mqtt-0.6.0/src/dbus2mqtt/dbus/dbus_client.py +1065 -0
  68. dbus2mqtt-0.6.0/src/dbus2mqtt/dbus/dbus_types.py +37 -0
  69. dbus2mqtt-0.6.0/src/dbus2mqtt/dbus/dbus_util.py +177 -0
  70. dbus2mqtt-0.6.0/src/dbus2mqtt/dbus/introspection_patches/mpris_playerctl.py +151 -0
  71. dbus2mqtt-0.6.0/src/dbus2mqtt/dbus/introspection_patches/mpris_vlc.py +122 -0
  72. dbus2mqtt-0.6.0/src/dbus2mqtt/event_broker.py +53 -0
  73. dbus2mqtt-0.6.0/src/dbus2mqtt/flow/__init__.py +61 -0
  74. dbus2mqtt-0.6.0/src/dbus2mqtt/flow/actions/context_set.py +30 -0
  75. dbus2mqtt-0.6.0/src/dbus2mqtt/flow/actions/log_action.py +36 -0
  76. dbus2mqtt-0.6.0/src/dbus2mqtt/flow/actions/mqtt_publish.py +57 -0
  77. dbus2mqtt-0.6.0/src/dbus2mqtt/flow/flow_processor.py +291 -0
  78. dbus2mqtt-0.6.0/src/dbus2mqtt/main.py +145 -0
  79. dbus2mqtt-0.6.0/src/dbus2mqtt/mqtt/mqtt_client.py +233 -0
  80. dbus2mqtt-0.6.0/src/dbus2mqtt/template/__init__.py +0 -0
  81. dbus2mqtt-0.6.0/src/dbus2mqtt/template/dbus_template_functions.py +129 -0
  82. dbus2mqtt-0.6.0/src/dbus2mqtt/template/templating.py +169 -0
  83. dbus2mqtt-0.6.0/tests/__init__.py +76 -0
  84. dbus2mqtt-0.6.0/tests/config/fixtures/backwards_compat_check_264.yaml +8 -0
  85. dbus2mqtt-0.6.0/tests/config/fixtures/payload_template_jinja_expressions.yaml +24 -0
  86. dbus2mqtt-0.6.0/tests/config/fixtures/payload_template_off.yaml +14 -0
  87. dbus2mqtt-0.6.0/tests/config/fixtures/schedule_cron_trigger.yaml +9 -0
  88. dbus2mqtt-0.6.0/tests/config/test_config.py +93 -0
  89. dbus2mqtt-0.6.0/tests/config/test_examples.py +32 -0
  90. dbus2mqtt-0.6.0/tests/conftest.py +16 -0
  91. dbus2mqtt-0.6.0/tests/dbus/test_dbus_client.py +53 -0
  92. dbus2mqtt-0.6.0/tests/dbus/test_dbus_client_mqtt_command.py +242 -0
  93. dbus2mqtt-0.6.0/tests/dbus/test_dbus_utils.py +402 -0
  94. dbus2mqtt-0.6.0/tests/flow/actions/test_context_set.py +60 -0
  95. dbus2mqtt-0.6.0/tests/flow/actions/test_log.py +28 -0
  96. dbus2mqtt-0.6.0/tests/flow/actions/test_mqtt_publish.py +33 -0
  97. dbus2mqtt-0.6.0/tests/flow/test_flow_processor.py +216 -0
  98. dbus2mqtt-0.6.0/tests/flow/triggers/test_context_set_triggers.py +53 -0
  99. dbus2mqtt-0.6.0/tests/flow/triggers/test_dbus_client_triggers.py +219 -0
  100. dbus2mqtt-0.6.0/tests/flow/triggers/test_mqtt_client_triggers.py +92 -0
  101. dbus2mqtt-0.6.0/tests/template/test_templating.py +166 -0
  102. dbus2mqtt-0.6.0/tests/template/test_templating_config.py +88 -0
  103. dbus2mqtt-0.6.0/uv.lock +1174 -0
@@ -0,0 +1,14 @@
1
+ # Ignore everything
2
+ *
3
+
4
+ # Allow files and directories
5
+ !/src
6
+ !/tests
7
+ !/docs/**.yaml
8
+
9
+ !/pyproject.toml
10
+ !/uv.lock
11
+ !/.python-version
12
+
13
+ !/LICENSE
14
+ !/README.md
@@ -0,0 +1,4 @@
1
+ MQTT__HOST=localhost
2
+ MQTT__PORT=1883
3
+ MQTT__USERNAME=
4
+ MQTT__PASSWORD=
@@ -0,0 +1,41 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Describe the bug**
11
+ A clear and concise description of what the bug is.
12
+
13
+ **To Reproduce**
14
+ Steps to reproduce the behavior:
15
+
16
+ 1. Go to '...'
17
+ 2. Click on '....'
18
+ 3. Scroll down to '....'
19
+ 4. See error
20
+
21
+ **Expected behavior**
22
+ A clear and concise description of what you expected to happen.
23
+
24
+ **Screenshots**
25
+ If applicable, add screenshots to help explain your problem.
26
+
27
+ **Desktop (please complete the following information):**
28
+
29
+ - OS: [e.g. iOS]
30
+ - Browser [e.g. chrome, safari]
31
+ - Version [e.g. 22]
32
+
33
+ **Smartphone (please complete the following information):**
34
+
35
+ - Device: [e.g. iPhone6]
36
+ - OS: [e.g. iOS8.1]
37
+ - Browser [e.g. stock browser, safari]
38
+ - Version [e.g. 22]
39
+
40
+ **Additional context**
41
+ Add any other context about the problem here.
@@ -0,0 +1,20 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea for this project
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Is your feature request related to a problem? Please describe.**
11
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12
+
13
+ **Describe the solution you'd like**
14
+ A clear and concise description of what you want to happen.
15
+
16
+ **Describe alternatives you've considered**
17
+ A clear and concise description of any alternative solutions or features you've considered.
18
+
19
+ **Additional context**
20
+ Add any other context or screenshots about the feature request here.
@@ -0,0 +1,51 @@
1
+ name-template: 'v$RESOLVED_VERSION'
2
+ tag-template: 'v$RESOLVED_VERSION'
3
+ exclude-labels:
4
+ - dependencies
5
+ - skip-changelog
6
+ categories:
7
+ - title: 🚨 Breaking changes
8
+ labels:
9
+ - breaking-change
10
+ - title: 🚀 Features
11
+ labels:
12
+ - feature
13
+ - enhancement
14
+ - title: 🐛 Bug Fixes
15
+ labels:
16
+ - bugfix
17
+ - title: 🧰 Misc
18
+ labels:
19
+ - chore
20
+ - documentation
21
+ - title: ⬆️ Dependency updates
22
+ labels:
23
+ - dependencies
24
+ exclude-contributors:
25
+ - jwnmulder
26
+ autolabeler:
27
+ - label: enhancement
28
+ branch:
29
+ - '/feature\/.+/'
30
+ - label: bugfix
31
+ branch:
32
+ - '/fix\/.+/'
33
+ title:
34
+ - '/fix/i'
35
+ version-resolver:
36
+ major:
37
+ labels:
38
+ - major
39
+ minor:
40
+ labels:
41
+ - minor
42
+ - breaking-change # minor until we are on 1.x
43
+ patch:
44
+ labels:
45
+ - patch
46
+ - feature # patch until we are on 1.x
47
+ - enhancement # patch until we are on 1.x
48
+ default: patch
49
+ change-template: '* $TITLE (#$NUMBER) by @$AUTHOR'
50
+ template: |
51
+ $CHANGES
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env python3
2
+ import json
3
+ import subprocess
4
+ import sys
5
+
6
+ from packaging import version
7
+
8
+
9
+ def get_versions_from_git_tags() -> list[version.Version]:
10
+ result = subprocess.run(
11
+ ["git", "tag"],
12
+ capture_output=True, text=True, check=True
13
+ )
14
+ tags = result.stdout.strip().splitlines()
15
+ versions = [t.lstrip("v") for t in tags if t.startswith("v")]
16
+
17
+ parsed_versions = []
18
+ for v in versions:
19
+ try:
20
+ parsed = version.parse(v)
21
+ parsed_versions.append(parsed)
22
+ except Exception as e:
23
+ print(f"Error parsing version {v}: {e}")
24
+
25
+ return parsed_versions
26
+
27
+ def latest_version_by_cycle(versions: list[version.Version], cycles: list[str]) -> dict[str, version.Version]:
28
+ res = {}
29
+ for cycle_str in cycles:
30
+ cycle = version.parse(cycle_str)
31
+
32
+ for v in versions:
33
+ # check if version is in cycle range
34
+ # cycle can be major or major.minor or major.minor.patch
35
+ if len(v.release) > len(cycle.release) and v.base_version.startswith(cycle.base_version):
36
+ # update if version is later within cycle
37
+ if cycle not in cycles or v > cycle:
38
+ res[cycle_str] = v
39
+ return res
40
+
41
+ def main():
42
+ args = sys.argv[1:]
43
+ if not args:
44
+ print("Usage: release-versions.py 0.1 0.2 1.0 ...")
45
+ sys.exit(1)
46
+
47
+ versions = get_versions_from_git_tags()
48
+ cycles = latest_version_by_cycle(versions, args)
49
+
50
+ # Detect the overall latest version
51
+ overall_latest = max(versions) if versions else None
52
+
53
+ cycle_details = []
54
+ for cycle in args:
55
+ latest = cycles.get(cycle)
56
+ if latest:
57
+ cycle_details.append({
58
+ "cycle": cycle,
59
+ "latestVersion": latest.base_version,
60
+ "isLatestStable": latest == overall_latest
61
+ })
62
+
63
+ print(json.dumps(cycle_details))
64
+
65
+ if __name__ == "__main__":
66
+ main()
@@ -0,0 +1,41 @@
1
+ name: CI
2
+
3
+ "on":
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+ workflow_dispatch:
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ strategy:
16
+ matrix:
17
+ python-version:
18
+ - "3.10"
19
+ - "3.11"
20
+ - "3.12"
21
+ - "3.13"
22
+ - "3.14"
23
+
24
+ steps:
25
+ - uses: actions/checkout@v6
26
+
27
+ - name: Install uv
28
+ uses: astral-sh/setup-uv@v7
29
+ with:
30
+ activate-environment: true
31
+ enable-cache: true
32
+ python-version: ${{ matrix.python-version }}
33
+
34
+ # - name: "Set up Python"
35
+ # uses: actions/setup-python@v5
36
+ # with:
37
+ # python-version: ${{ matrix.python-version }}
38
+
39
+ - name: Run tests
40
+ run: uv run pytest
41
+ # run: uv run --python ${{ matrix.python-version }} pytest
@@ -0,0 +1,29 @@
1
+ name: deploy-docs
2
+
3
+ "on":
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ deploy-docs:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ steps:
14
+ - name: Checkout
15
+ uses: actions/checkout@v6
16
+ with:
17
+ fetch-depth: 0
18
+ - name: Configure Git Credentials
19
+ run: |
20
+ git config user.name github-actions[bot]
21
+ git config user.email 41898282+github-actions[bot]@users.noreply.github.com
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v7
24
+ with:
25
+ activate-environment: true
26
+ enable-cache: true
27
+ - name: gh-deploy
28
+ run: |
29
+ uv run mkdocs gh-deploy --force
@@ -0,0 +1,81 @@
1
+ name: docker-dev
2
+
3
+ "on":
4
+ push:
5
+ branches:
6
+ - main
7
+ paths-ignore:
8
+ - 'docs/**'
9
+ - 'tests/**'
10
+ - '.pre-commit-config.yaml'
11
+ - 'README.md'
12
+ - 'renovate.json'
13
+ - 'mkdocs.yaml'
14
+ workflow_dispatch:
15
+
16
+ jobs:
17
+ docker:
18
+ runs-on: ubuntu-latest
19
+ permissions:
20
+ packages: write
21
+ steps:
22
+ - name: Checkout
23
+ uses: actions/checkout@v6
24
+
25
+ - name: Install uv
26
+ uses: astral-sh/setup-uv@v7
27
+ with:
28
+ enable-cache: true
29
+
30
+ # - name: "Set up Python"
31
+ # uses: actions/setup-python@v5
32
+ # with:
33
+ # python-version-file: ".python-version"
34
+
35
+ - name: Determine version from hatch
36
+ id: version
37
+ run: echo "PRETEND_VERSION=$(uvx hatch version)" >> "$GITHUB_OUTPUT"
38
+
39
+ - name: Docker meta
40
+ id: meta
41
+ uses: docker/metadata-action@v5
42
+ with:
43
+ images: |
44
+ jwnmulder/dbus2mqtt
45
+ ghcr.io/jwnmulder/dbus2mqtt
46
+ tags: |
47
+ type=raw,value=dev,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
48
+ labels: |
49
+ org.opencontainers.image.source=https://github.com/jwnmulder/dbus2mqtt
50
+
51
+ - name: Set up QEMU
52
+ uses: docker/setup-qemu-action@v3
53
+
54
+ - name: Set up Docker Buildx
55
+ uses: docker/setup-buildx-action@v3
56
+
57
+ - name: Login to DockerHub
58
+ if: github.event_name != 'pull_request'
59
+ uses: docker/login-action@v3
60
+ with:
61
+ username: jwnmulder
62
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
63
+
64
+ - name: Login to GHCR
65
+ if: github.event_name != 'pull_request'
66
+ uses: docker/login-action@v3
67
+ with:
68
+ registry: ghcr.io
69
+ username: jwnmulder
70
+ password: ${{ secrets.GITHUB_TOKEN }}
71
+
72
+ - name: Build and push
73
+ uses: docker/build-push-action@v6
74
+ with:
75
+ context: .
76
+ file: ./docker/Dockerfile.dev
77
+ push: ${{ github.event_name != 'pull_request' }}
78
+ tags: ${{ steps.meta.outputs.tags }}
79
+ labels: ${{ steps.meta.outputs.labels }}
80
+ build-args: |
81
+ PRETEND_VERSION=${{ steps.version.outputs.PRETEND_VERSION }}
@@ -0,0 +1,101 @@
1
+ name: docker-stable releases
2
+
3
+ "on":
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - "docker/**"
9
+ workflow_run:
10
+ workflows: ["Publish Python Package"]
11
+ types:
12
+ - completed
13
+ workflow_dispatch:
14
+
15
+ jobs:
16
+ setup:
17
+ runs-on: ubuntu-latest
18
+ outputs:
19
+ versions_matrix: ${{ steps.supported_release_versions.outputs.versions_matrix }}
20
+ steps:
21
+ - name: Checkout
22
+ uses: actions/checkout@v6
23
+ with:
24
+ fetch-depth: 0
25
+
26
+ - name: Determine supported release versions
27
+ id: supported_release_versions
28
+ run: |
29
+ SUPPORTED_CYCLES=("0.4" "0.5" "0.6" "0.7" "0.8" "0.9" "1.0" "2.0")
30
+
31
+ VERSIONS_JSON=$(python3 .github/scripts/release-versions.py "${SUPPORTED_CYCLES[@]}")
32
+
33
+ # Wrap the output into matrix include
34
+ VERSIONS_MATRIX=$(echo "$VERSIONS_JSON" | jq -c '{include: [.[] | {cycle: .cycle, version: .latestVersion, isLatestStable: .isLatestStable}]}')
35
+
36
+ echo "VERSIONS_MATRIX=$VERSIONS_MATRIX"
37
+ echo "versions_matrix=$VERSIONS_MATRIX" >> $GITHUB_OUTPUT
38
+ docker:
39
+ runs-on: ubuntu-latest
40
+ needs: setup
41
+ permissions:
42
+ packages: write
43
+ strategy:
44
+ fail-fast: false
45
+ matrix: ${{ fromJson(needs.setup.outputs.versions_matrix) }}
46
+
47
+ steps:
48
+ - name: Checkout
49
+ uses: actions/checkout@v6
50
+
51
+ - name: Docker meta
52
+ id: meta
53
+ uses: docker/metadata-action@v5
54
+ with:
55
+ images: |
56
+ jwnmulder/dbus2mqtt
57
+ ghcr.io/jwnmulder/dbus2mqtt
58
+ tags: |
59
+ type=raw,value=latest,enable=${{ matrix.isLatestStable }}
60
+ type=pep440,pattern={{major}},value=${{ matrix.version }},enable=${{ !startsWith(matrix.version, '0.') }}
61
+ type=pep440,pattern={{major}}.{{minor}},value=${{ matrix.version }}
62
+ type=pep440,pattern={{major}}.{{minor}}.{{patch}},value=${{ matrix.version }}
63
+ # type=ref,event=branch
64
+ # type=ref,event=pr
65
+ # type=semver,pattern={{version}},value=${{ matrix.version }}
66
+ flavor:
67
+ latest=false
68
+ labels: |
69
+ org.opencontainers.image.source=https://github.com/jwnmulder/dbus2mqtt
70
+
71
+ - name: Set up QEMU
72
+ uses: docker/setup-qemu-action@v3
73
+
74
+ - name: Set up Docker Buildx
75
+ uses: docker/setup-buildx-action@v3
76
+
77
+ - name: Login to DockerHub
78
+ if: github.event_name != 'pull_request'
79
+ uses: docker/login-action@v3
80
+ with:
81
+ username: jwnmulder
82
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
83
+
84
+ - name: Login to GHCR
85
+ if: github.event_name != 'pull_request'
86
+ uses: docker/login-action@v3
87
+ with:
88
+ registry: ghcr.io
89
+ username: jwnmulder
90
+ password: ${{ secrets.GITHUB_TOKEN }}
91
+
92
+ - name: Build and push
93
+ uses: docker/build-push-action@v6
94
+ with:
95
+ context: .
96
+ file: ./docker/Dockerfile.pypi
97
+ push: ${{ github.event_name != 'pull_request' }}
98
+ tags: ${{ steps.meta.outputs.tags }}
99
+ labels: ${{ steps.meta.outputs.labels }}
100
+ build-args: |
101
+ DBUS2MQTT_VERSION=${{ matrix.version }}
@@ -0,0 +1,31 @@
1
+ name: pre-commit
2
+
3
+ "on":
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - main
10
+ repository_dispatch:
11
+
12
+ jobs:
13
+ pre-commit:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v7
20
+ with:
21
+ activate-environment: true
22
+ enable-cache: true
23
+ cache-dependency-glob: |
24
+ **/uv.lock
25
+ **/pyproject.toml
26
+ **/.pre-commit-config.yaml
27
+
28
+ - name: Uv sync
29
+ run: uv sync
30
+
31
+ - uses: pre-commit/action@v3.0.1
@@ -0,0 +1,57 @@
1
+ name: Publish Python Package
2
+
3
+ "on":
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ release-build:
12
+ runs-on: ubuntu-latest
13
+
14
+ steps:
15
+ - uses: actions/checkout@v6
16
+ with:
17
+ persist-credentials: false
18
+
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v7
21
+ with:
22
+ activate-environment: true
23
+ enable-cache: true
24
+
25
+ # - name: "Set up Python"
26
+ # uses: actions/setup-python@v5
27
+ # with:
28
+ # python-version-file: ".python-version"
29
+
30
+ - name: Build
31
+ run: uv build
32
+
33
+ - name: Store the distribution packages
34
+ uses: actions/upload-artifact@v6
35
+ with:
36
+ name: release-dists
37
+ path: dist/
38
+
39
+ pypi-publish:
40
+ runs-on: ubuntu-latest
41
+ needs:
42
+ - release-build
43
+ permissions:
44
+ id-token: write
45
+ environment:
46
+ name: pypi
47
+ url: https://pypi.org/p/dbus2mqtt
48
+
49
+ steps:
50
+ - name: Retrieve release distributions
51
+ uses: actions/download-artifact@v7
52
+ with:
53
+ name: release-dists
54
+ path: dist/
55
+
56
+ - name: Publish release distributions to PyPI
57
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,26 @@
1
+ name: Release Drafter
2
+
3
+ "on":
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ types: [opened, reopened, synchronize]
9
+ workflow_dispatch:
10
+
11
+ permissions:
12
+ contents: read
13
+
14
+ jobs:
15
+ update_release_draft:
16
+ permissions:
17
+ # write permission is required to create a github release
18
+ contents: write
19
+ # write permission is required for autolabeler
20
+ # otherwise, read permission is required at least
21
+ pull-requests: write
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: release-drafter/release-drafter@v6
25
+ env:
26
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,35 @@
1
+ name: trivy
2
+
3
+ "on":
4
+ schedule:
5
+ - cron: '15 10 * * 1'
6
+ workflow_dispatch: {}
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ scan:
13
+ permissions:
14
+ contents: read # for actions/checkout to fetch code
15
+ security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
16
+ actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
17
+ name: Scan
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - name: Checkout code
21
+ uses: actions/checkout@v6
22
+
23
+ - name: Run Trivy vulnerability scanner
24
+ uses: aquasecurity/trivy-action@0.33.1
25
+ with:
26
+ image-ref: ghcr.io/jwnmulder/dbus2mqtt:latest
27
+ format: 'sarif'
28
+ output: 'trivy-results.sarif'
29
+ severity: 'CRITICAL,HIGH'
30
+ ignore-unfixed: true
31
+
32
+ - name: Upload Trivy scan results to GitHub Security tab
33
+ uses: github/codeql-action/upload-sarif@v4
34
+ with:
35
+ sarif_file: 'trivy-results.sarif'
@@ -0,0 +1,25 @@
1
+ name: uv-lock-report
2
+
3
+ "on":
4
+ pull_request:
5
+ paths:
6
+ - uv.lock
7
+ branches:
8
+ - main
9
+ jobs:
10
+ report:
11
+ if: github.head_ref == 'renovate/lock-file-maintenance'
12
+ permissions:
13
+ contents: read
14
+ pull-requests: write
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v6
18
+ with:
19
+ fetch-depth: 0
20
+
21
+ - name: Report
22
+ uses: mw-root/uv-lock-report@v0.13.0
23
+ with:
24
+ github-token: ${{ secrets.GITHUB_TOKEN }}
25
+ output-format: table
@@ -0,0 +1,23 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ dist/
8
+ site/
9
+
10
+ # Environments
11
+ .env
12
+ .venv
13
+
14
+ # Ruff stuff:
15
+ .ruff_cache/
16
+
17
+ ### VisualStudioCode ###
18
+ .vscode/*
19
+ !.vscode/settings.json
20
+ !.vscode/tasks.json
21
+ !.vscode/launch.json
22
+ !.vscode/extensions.json
23
+ *.code-workspace
@@ -0,0 +1,5 @@
1
+ {
2
+ "MD013": false,
3
+ "MD033": false,
4
+ "MD060": false
5
+ }