-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4465e65
commit 97cf9c8
Showing
4 changed files
with
277 additions
and
0 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,129 @@ | ||
name: Publish | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.set_output.outputs.version }} | ||
upload_url: ${{ steps.set_output.outputs.upload_url }} | ||
env: | ||
VERSION: "" | ||
UPLOAD_URL: "" | ||
steps: | ||
- name: Get version and upload url from release | ||
if: github.event_name == 'release' | ||
run: | | ||
echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV | ||
echo "UPLOAD_URL=${{ github.event.release.upload_url }}" >> $GITHUB_ENV | ||
- name: Get release from API | ||
if: github.event_name == 'workflow_dispatch' | ||
id: release_api | ||
uses: octokit/[email protected] | ||
with: | ||
route: GET /repos/${{ github.repository }}/releases/latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
|
||
- name: Parse API response | ||
if: github.event_name == 'workflow_dispatch' | ||
run: | | ||
echo "VERSION=${{ fromJson(steps.release_api.outputs.data).tag_name }}" >> $GITHUB_ENV | ||
echo "UPLOAD_URL=${{ fromJson(steps.release_api.outputs.data).upload_url }}" >> $GITHUB_ENV | ||
- name: Log version and upload URL | ||
run: | | ||
echo "Version: $VERSION" | ||
echo "Upload URL: $UPLOAD_URL" | ||
- name: Fail if no version or no upload URL | ||
run: | | ||
if [[ -z "$VERSION" || -z "$UPLOAD_URL" ]]; then | ||
echo "Missing version or upload URL" | ||
exit 1 | ||
fi | ||
- name: Set outputs | ||
id: set_output | ||
run: | | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
echo "upload_url=$UPLOAD_URL" >> $GITHUB_OUTPUT | ||
package: | ||
needs: version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Load cached Poetry installation | ||
id: cached-poetry | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.local | ||
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install Poetry | ||
if: steps.cached-poetry.outputs.cache-hit != 'true' | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Load cached Poetry venv | ||
id: cached-poetry-venv | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: poetry-venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cached-poetry-venv.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
|
||
- name: Install package | ||
run: poetry install --no-interaction | ||
|
||
- name: Set package version | ||
run: | | ||
poetry version ${{ needs.version.outputs.version }} | ||
- name: Build package | ||
run: | | ||
poetry build | ||
- name: Upload package to pyPI | ||
run: | | ||
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} | ||
poetry publish | ||
- name: Upload package to release | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
with: | ||
upload_url: ${{ needs.version.outputs.upload_url }} | ||
asset_path: ./dist/eq3btsmart-${{ needs.version.outputs.version }}.tar.gz | ||
asset_name: eq3btsmart-${{ needs.version.outputs.version }}.tar.gz | ||
asset_content_type: application/gzip | ||
|
||
- name: Upload wheel to release | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} | ||
with: | ||
upload_url: ${{ needs.version.outputs.upload_url }} | ||
asset_path: ./dist/eq3btsmart-${{ needs.version.outputs.version }}-py3-none-any.whl | ||
asset_name: eq3btsmart-${{ needs.version.outputs.version }}-py3-none-any.whl | ||
asset_content_type: application/zip |
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,113 @@ | ||
name: Code Quality | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
|
||
jobs: | ||
cache: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Load cached Poetry installation | ||
id: cached-poetry | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.local | ||
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install Poetry | ||
if: steps.cached-poetry.outputs.cache-hit != 'true' | ||
uses: snok/install-poetry@v1 | ||
with: | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Load cached Poetry venv | ||
id: cached-poetry-venv | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: poetry-venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install dependencies | ||
if: steps.cached-poetry-venv.outputs.cache-hit != 'true' | ||
run: poetry install --no-interaction --no-root | ||
|
||
- name: Install package | ||
run: poetry install --no-interaction | ||
|
||
ruff: | ||
needs: cache | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Load cached Poetry installation | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.local | ||
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Load cached Poetry venv | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.venv | ||
key: poetry-venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install package | ||
run: | | ||
poetry install --no-interaction | ||
- name: Run ruff | ||
run: | | ||
poetry run ruff . --check | ||
mypy: | ||
needs: cache | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Load cached Poetry installation | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.local | ||
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Load cached Poetry venv | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.venv | ||
key: poetry-venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }} | ||
|
||
- name: Install package | ||
run: | | ||
poetry install --no-interaction | ||
- name: Run mypy | ||
run: | | ||
poetry run mypy eq3btsmart custom_components/eq3btsmart |
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,23 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
concurrency: release | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
persist-credentials: false | ||
|
||
- name: Semantic Release | ||
uses: cycjimmy/semantic-release-action@v4 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.PAT }} |
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,12 @@ | ||
{ | ||
"repository_url": "https://github.com/dbuezas/eq3btsmart.git", | ||
"branches": [ | ||
"master" | ||
], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/github" | ||
], | ||
"tagFormat": "${version}" | ||
} |