1- name : Release Workflow
1+ name : Publish
22
33on :
44 release :
55 types :
66 - published
7+ push :
8+ branches :
9+ - main
10+
11+ concurrency :
12+ group : publish-${{ github.ref }}
13+ cancel-in-progress : true
14+
15+ permissions : {}
716
817jobs :
9- release :
10- name : Release
18+ release_zip_file :
19+ name : Publish readme zip file asset
1120 runs-on : ubuntu-latest
21+ permissions :
22+ contents : write
1223 steps :
1324 - name : 📥 Checkout the repository
14- uses : actions/checkout@v2
25+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1526
16- - name : 🔢 Get release version
17- id : version
18- uses : home-assistant/actions/helpers/version@master
27+ - name : 🛠️ Set up Python
28+ uses : actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
29+ with :
30+ python-version : " 3.13"
1931
20- - name : ℹ️ Get integration information
21- id : information
22- run : |
23- name=$(find custom_components/ -type d -maxdepth 1 | tail -n 1 | cut -d "/" -f2)
24- echo "::set-output name=name::$name"
32+ - name : 🔢 Get version
33+ if : ${{ github.event_name == 'release' }}
34+ id : version
35+ uses : home-assistant/actions/helpers/version@a19f5f4e08ef2786e4604a948f62addd937a6bc9 # master
2536
26- - name : 🖊️ Set version number
37+ # Pack the readme dir as a zip and upload to the release
38+ - name : 📦 ZIP readme dir
2739 run : |
28- sed -i '/INTEGRATION_VERSION = /c\INTEGRATION_VERSION = "${{ steps.version.outputs.version }}"' \
29- "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/const.py"
30- jq '.version = "${{ steps.version.outputs.version }}"' \
31- "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/manifest.json" > tmp \
32- && mv -f tmp "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/manifest.json"
40+ cd ${{ github.workspace }}/custom_components/readme
41+ zip readme.zip -r ./
3342
34- - name : 👀 Validate data
35- run : |
36- if ! grep -q 'INTEGRATION_VERSION = "${{ steps.version.outputs.version }}"' ${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/const.py; then
37- echo "The version in custom_components/${{ steps.information.outputs.name }}/const.py was not correct"
38- cat ${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/const.py | grep INTEGRATION_VERSION
39- exit 1
40- fi
41- manifestversion=$(jq -r '.version' ${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/manifest.json)
42- if [ "$manifestversion" != "${{ steps.version.outputs.version }}" ]; then
43- echo "The version in custom_components/${{ steps.information.outputs.name }}/manifest.json was not correct"
44- echo "$manifestversion"
45- exit 1
46- fi
47-
48- - name : 📦 Create zip file for the integration
49- run : |
50- cd "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}"
51- zip ${{ steps.information.outputs.name }}.zip -r ./
43+ - name : 📤 Upload zip to action
44+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
45+ if : ${{ github.event_name == 'push' }}
46+ with :
47+ name : readme.zip
48+ path : ${{ github.workspace }}/custom_components/readme/readme.zip
49+ retention-days : 7
5250
53- - name : 📤 Upload the zip file as a release asset
54- uses : actions/upload-release-asset@v1
55- env :
56- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
51+ - name : 📤 Upload zip to release
52+ uses : softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
53+ if : ${{ github.event_name == 'release' }}
5754 with :
58- upload_url : ${{ github.event.release.upload_url }}
59- asset_path : " ${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/${{ steps.information.outputs.name }}.zip"
60- asset_name : ${{ steps.information.outputs.name }}.zip
61- asset_content_type : application/zip
55+ files : ${{ github.workspace }}/custom_components/readme/readme.zip
0 commit comments