File tree Expand file tree Collapse file tree 4 files changed +84
-3
lines changed Expand file tree Collapse file tree 4 files changed +84
-3
lines changed Original file line number Diff line number Diff line change
1
+ name : Publish
2
+
3
+ on :
4
+ release :
5
+ types :
6
+ - published
7
+ push :
8
+ branches :
9
+ - main
10
+
11
+ jobs :
12
+ release_zip_file :
13
+ name : Publish zip file asset
14
+ runs-on : ubuntu-latest
15
+ permissions :
16
+ contents : write
17
+ steps :
18
+ - name : 📥 Checkout the repository
19
+
20
+
21
+ - name : 🛠️ Set up Python
22
+
23
+ with :
24
+ python-version : " 3.x"
25
+
26
+ - name : 🔢 Get version
27
+ id : version
28
+ uses : home-assistant/actions/helpers/version@master
29
+
30
+ - name : 🔢 Set version number
31
+ run : |
32
+ python3 ${{ github.workspace }}/manage/update_manifest.py --version ${{ steps.version.outputs.version }}
33
+
34
+ - name : 📤 Upload zip to action
35
+
36
+ if : ${{ github.event_name == 'push' }}
37
+ with :
38
+ name : ocpp
39
+ path : ${{ github.workspace }}/custom_components/ocpp
40
+
41
+ # Pack the dir as a zip and upload to the release
42
+ - name : 📦 ZIP Dir
43
+ if : ${{ github.event_name == 'release' }}
44
+ run : |
45
+ cd ${{ github.workspace }}/custom_components/ocpp
46
+ zip ocpp.zip -r ./
47
+
48
+ - name : 📤 Upload zip to release
49
+ uses : softprops/action-gh-release@v1
50
+ if : ${{ github.event_name == 'release' }}
51
+ with :
52
+ files : ${{ github.workspace }}/custom_components/ocpp/ocpp.zip
Original file line number Diff line number Diff line change 3
3
[ ![ 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 )
4
4
[ ![ codecov] ( https://codecov.io/gh/lbbrhzn/ocpp/branch/main/graph/badge.svg?token=3FRJIF5KRW )] ( https://codecov.io/gh/lbbrhzn/ocpp )
5
5
[ ![ Documentation Status] ( https://readthedocs.org/projects/home-assistant-ocpp/badge/?version=latest )] ( https://home-assistant-ocpp.readthedocs.io/en/latest/?badge=latest )
6
+ [ ![ hacs_downloads] ( https://img.shields.io/github/downloads/lbbrhzn/ocpp/latest/total )] ( https://github.com/lbbrhzn/ocpp/releases/latest )
6
7
7
8
![ OCPP] ( https://github.com/home-assistant/brands/raw/master/custom_integrations/ocpp/icon.png )
8
9
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " Open Charge Point Protocol (OCPP)" ,
3
3
"content_in_root" : false ,
4
- "homeassistant" : " 2021.12.0" ,
5
- "render_readme" : true
6
- }
4
+ "homeassistant" : " 2022.7.0" ,
5
+ "render_readme" : true ,
6
+ "zip_release" : true ,
7
+ "filename" : " ocpp.zip"
8
+ }
Original file line number Diff line number Diff line change
1
+ """Update the manifest file."""
2
+ # https://github.com/hacs/integration/blob/main/manage/update_manifest.py
3
+ import json
4
+ import os
5
+ import sys
6
+
7
+
8
+ def update_manifest ():
9
+ """Update the manifest file."""
10
+ version = "0.0.0"
11
+ for index , value in enumerate (sys .argv ):
12
+ if value in ["--version" , "-V" ]:
13
+ version = sys .argv [index + 1 ]
14
+
15
+ with open (f"{ os .getcwd ()} /custom_components/ocpp/manifest.json" ) as manifestfile :
16
+ manifest = json .load (manifestfile )
17
+
18
+ manifest ["version" ] = version
19
+
20
+ with open (
21
+ f"{ os .getcwd ()} /custom_components/ocpp/manifest.json" , "w"
22
+ ) as manifestfile :
23
+ manifestfile .write (json .dumps (manifest , indent = 4 , sort_keys = True ))
24
+
25
+
26
+ update_manifest ()
You can’t perform that action at this time.
0 commit comments