From a596488d592862175833582467f7e0aa3bb50378 Mon Sep 17 00:00:00 2001 From: Piotr Machowski Date: Thu, 3 Apr 2025 01:07:31 +0200 Subject: [PATCH] Add GitHub Actions --- .github/workflows/hacs.yaml | 17 +++++++++ .github/workflows/hassfest.yaml | 16 ++++++++ .github/workflows/release.yaml | 37 +++++++++++++++++++ .../roborock_custom_map/manifest.json | 1 - 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/hacs.yaml create mode 100644 .github/workflows/hassfest.yaml create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/hacs.yaml b/.github/workflows/hacs.yaml new file mode 100644 index 0000000..d04983d --- /dev/null +++ b/.github/workflows/hacs.yaml @@ -0,0 +1,17 @@ +--- +name: Validate HACS +on: + push: + pull_request: +jobs: + hacs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + name: Checkout code + + - name: HACS Action + uses: hacs/action@main + with: + category: integration + ignore: brands diff --git a/.github/workflows/hassfest.yaml b/.github/workflows/hassfest.yaml new file mode 100644 index 0000000..c37182e --- /dev/null +++ b/.github/workflows/hassfest.yaml @@ -0,0 +1,16 @@ +--- +name: Validate with hassfest + +on: + push: + pull_request: + +jobs: + hassfest: + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v4 + name: Checkout code + + - uses: home-assistant/actions/hassfest@master + name: Run hassfest validation diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..972545d --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,37 @@ +name: Release + +on: + release: + types: [published] + +env: + COMPONENT_NAME: roborock_custom_map + +jobs: + release: + name: Prepare release + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + steps: + - name: Download repo + uses: actions/checkout@v4 + + - name: Adjust version number + shell: bash + run: | + version="${{ github.event.release.tag_name }}" + yq e -P -o=json \ + -i ".version = \"${version}\"" \ + "${{ github.workspace }}/custom_components/${{ env.COMPONENT_NAME }}/manifest.json" + + - name: Zip ${{ env.COMPONENT_NAME }} dir + run: | + cd "${{ github.workspace }}/custom_components/${{ env.COMPONENT_NAME }}" + zip ${{ env.COMPONENT_NAME }}.zip -r ./ + + - name: Upload zip to release + uses: softprops/action-gh-release@v2.1.0 + with: + files: ${{ github.workspace }}/custom_components/${{ env.COMPONENT_NAME }}/${{ env.COMPONENT_NAME }}.zip diff --git a/custom_components/roborock_custom_map/manifest.json b/custom_components/roborock_custom_map/manifest.json index e157a20..9058c2d 100644 --- a/custom_components/roborock_custom_map/manifest.json +++ b/custom_components/roborock_custom_map/manifest.json @@ -8,6 +8,5 @@ "iot_class": "local_polling", "issue_tracker": "https://github.com/Lash-L/RoborockCustomMap/issues", "requirements": [], - "version": "0.1.1" }