diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..db897b9 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,35 @@ +name-template: 'v$RESOLVED_VERSION 🌈' +tag-template: 'v$RESOLVED_VERSION' +change-template: '- #$NUMBER $TITLE @$AUTHOR' +sort-direction: ascending +categories: + - title: '🚀 Features' + labels: + - 'feature' + - 'enhancement' + + - title: '🐛 Bug Fixes' + labels: + - 'fix' + - 'bugfix' + - 'bug' + + - title: '🧰 Maintenance' + label: 'chore' + +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: patch +template: | + [![Downloads for this release](https://img.shields.io/github/downloads/JohNan/homeassistant-wellbeing/v$RESOLVED_VERSION/total.svg)](https://github.com/robinostlund/homeassistant-volkswagencarnet/releases/v$RESOLVED_VERSION) + ## Changes + + $CHANGES \ No newline at end of file diff --git a/.github/workflows/cron.yaml b/.github/workflows/cron.yaml new file mode 100644 index 0000000..9475676 --- /dev/null +++ b/.github/workflows/cron.yaml @@ -0,0 +1,28 @@ +name: "Cron actions 16:30 every 4 days" +on: + schedule: + - cron: '30 16 */4 * *' + +jobs: + validate-hassfest: + name: With hassfest + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Hassfest validation + uses: home-assistant/actions/hassfest@master + + validate-hacs: + name: With HACS action + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: HACS Validation + uses: hacs/action@main + with: + category: integration + comment: False diff --git a/.github/workflows/release-drafter.yaml b/.github/workflows/release-drafter.yaml new file mode 100644 index 0000000..c906184 --- /dev/null +++ b/.github/workflows/release-drafter.yaml @@ -0,0 +1,18 @@ +name: Release Drafter + +on: + push: + branches: + - master + +jobs: + update_release_draft: + name: Update release draft + runs-on: ubuntu-latest + steps: + - name: Create Release + uses: release-drafter/release-drafter@v5 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..004e5f9 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,35 @@ +name: Release + +on: + release: + types: [published] + +jobs: + release_zip_file: + name: Prepare release asset + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Get version + id: version + uses: home-assistant/actions/helpers/version@master + + - name: "Set version number" + run: | + python3 ${{ github.workspace }}/manage/update_manifest.py --version ${{ steps.version.outputs.version }} + + - name: Create zip + run: | + cd custom_components/wellbeing + zip wellbeing.zip -r ./ + + - name: Upload zip to release + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ./custom_components/wellbeing/wellbeing.zip + asset_name: volkswagencarnet.zip + tag: ${{ github.ref }} + overwrite: true \ No newline at end of file diff --git a/.github/workflows/validate.yaml b/.github/workflows/validate.yaml new file mode 100644 index 0000000..cb01984 --- /dev/null +++ b/.github/workflows/validate.yaml @@ -0,0 +1,33 @@ +name: "Validate" + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + validate-hassfest: + name: With hassfest + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Hassfest validation + uses: home-assistant/actions/hassfest@master + + validate-hacs: + name: With HACS action + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: HACS Validation + uses: hacs/action@main + with: + category: integration + comment: True diff --git a/custom_components/wellbeing/manifest.json b/custom_components/wellbeing/manifest.json index 349c016..b42a046 100644 --- a/custom_components/wellbeing/manifest.json +++ b/custom_components/wellbeing/manifest.json @@ -1,8 +1,8 @@ { "domain": "wellbeing", "name": "Wellbeing", - "documentation": "https://github.com/JohNan/wellbeing", - "issue_tracker": "https://github.com/JohNan/wellbeing/issues", + "documentation": "https://github.com/JohNan/homeassistant-wellbeing", + "issue_tracker": "https://github.com/JohNan/homeassistant-wellbeing/issues", "dependencies": [], "config_flow": true, "codeowners": ["@JohNan"], diff --git a/manage/update_manifest.py b/manage/update_manifest.py new file mode 100644 index 0000000..c5d15c7 --- /dev/null +++ b/manage/update_manifest.py @@ -0,0 +1,25 @@ +"""Update the manifest file.""" +import sys +import json +import os + + +def update_manifest(): + """Update the manifest file.""" + version = "0.0.0" + for index, value in enumerate(sys.argv): + if value in ["--version", "-V"]: + version = sys.argv[index + 1] + + with open(f"{os.getcwd()}/custom_components/wellbeing/manifest.json") as manifestfile: + manifest = json.load(manifestfile) + + manifest["version"] = version + + with open( + f"{os.getcwd()}/custom_components/wellbeing/manifest.json", "w" + ) as manifestfile: + manifestfile.write(json.dumps(manifest, indent=4, sort_keys=True)) + + +update_manifest() \ No newline at end of file