Skip to content
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
52 changes: 52 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish

on:
release:
types:
- published
push:
branches:
- main

jobs:
release_zip_file:
name: Publish zip file asset
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 📥 Checkout the repository
uses: actions/[email protected]

- name: 🛠️ Set up Python
uses: actions/[email protected]
with:
python-version: "3.x"

- 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: 📤 Upload zip to action
uses: actions/[email protected]
if: ${{ github.event_name == 'push' }}
with:
name: ocpp
path: ${{ github.workspace }}/custom_components/ocpp

# Pack the dir as a zip and upload to the release
- name: 📦 ZIP Dir
if: ${{ github.event_name == 'release' }}
run: |
cd ${{ github.workspace }}/custom_components/ocpp
zip ocpp.zip -r ./

- name: 📤 Upload zip to release
uses: softprops/action-gh-release@v1
if: ${{ github.event_name == 'release' }}
with:
files: ${{ github.workspace }}/custom_components/ocpp/ocpp.zip
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/lbbrhzn/ocpp.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/lbbrhzn/ocpp/context:python)
[![codecov](https://codecov.io/gh/lbbrhzn/ocpp/branch/main/graph/badge.svg?token=3FRJIF5KRW)](https://codecov.io/gh/lbbrhzn/ocpp)
[![Documentation Status](https://readthedocs.org/projects/home-assistant-ocpp/badge/?version=latest)](https://home-assistant-ocpp.readthedocs.io/en/latest/?badge=latest)
[![hacs_downloads](https://img.shields.io/github/downloads/lbbrhzn/ocpp/latest/total)](https://github.com/lbbrhzn/ocpp/releases/latest)

![OCPP](https://github.com/home-assistant/brands/raw/master/custom_integrations/ocpp/icon.png)

Expand Down
8 changes: 5 additions & 3 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"name": "Open Charge Point Protocol (OCPP)",
"content_in_root": false,
"homeassistant": "2021.12.0",
"render_readme": true
}
"homeassistant": "2022.7.0",
"render_readme": true,
"zip_release": true,
"filename": "ocpp.zip"
}
26 changes: 26 additions & 0 deletions manage/update_manifest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
"""Update the manifest file."""
# https://github.com/hacs/integration/blob/main/manage/update_manifest.py
import json
import os
import sys


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/ocpp/manifest.json") as manifestfile:
manifest = json.load(manifestfile)

manifest["version"] = version

with open(
f"{os.getcwd()}/custom_components/ocpp/manifest.json", "w"
) as manifestfile:
manifestfile.write(json.dumps(manifest, indent=4, sort_keys=True))


update_manifest()