Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: add GitHub actions to automatically build the package on tag version #20

Merged
merged 1 commit into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/building.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: 'Building release package'

on:
workflow_dispatch:
push:
tags:
- 'v*'

permissions:
contents: read

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Check out repository code
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Upgrade pip and install required tools
run: |
pip install --upgrade pip
pip install hatch

- name: Build the package
run: hatch -v build -t sdist

- name: Log package content
run: tar -tvf dist/*.tar.gz

- name: Install the package
run: pip install dist/*.tar.gz

- name: Test if the package is built correctly
run: python -c "import custom_components.econnect_alarm"

- name: Upload release archive
uses: actions/upload-artifact@v3
with:
name: econnect-alarm-{{ github.ref_name }}
path: dist/*.tar.gz
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,6 @@ allow-direct-references = true

[tool.pytest.ini_options]
asyncio_mode = "auto"

[tool.hatch.build.targets.sdist]
only-include = ["custom_components/econnect_alarm"]
Loading