Skip to content

Commit

Permalink
Adds GH Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
JohNan committed May 13, 2021
1 parent 32b20d5 commit 580bbd4
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 2 deletions.
35 changes: 35 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -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
28 changes: 28 additions & 0 deletions .github/workflows/cron.yaml
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
@@ -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 }}


35 changes: 35 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions custom_components/wellbeing/manifest.json
Original file line number Diff line number Diff line change
@@ -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"],
Expand Down
25 changes: 25 additions & 0 deletions manage/update_manifest.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 580bbd4

Please sign in to comment.