Skip to content

Commit

Permalink
ci: add archive to release
Browse files Browse the repository at this point in the history
It will:
  * allow use badges like
![GitHub release (latest by date)](https://img.shields.io/github/downloads/dolezsa/thermal_comfort/latest/total)
  * show downloads counters at HACS page
  * simplify manual installation
  • Loading branch information
IATkachenko committed Feb 2, 2022
1 parent 357e076 commit db3ed18
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .github/workflows/add_archive_to_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish archive

on:
release:
types: [published]

jobs:
build:
name: Publish archive
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: "Set package name"
working-directory: ./custom_components
run: echo "package=$(ls -F | grep \/$ | sed -n "s/\///g;1p")" >> $GITHUB_ENV

- name: "Set variables"
working-directory: ./custom_components
run: |
echo "archive=${{ env.package }}.zip" >> $GITHUB_ENV
echo "basedir=$(pwd)/${{ env.package }}" >> $GITHUB_ENV
- name: "Zip component dir"
working-directory: ./custom_components/${{ env.package }}
run: zip ${{ env.archive }} -r ./

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./custom_components/${{ env.package }}/${{ env.archive }}
asset_name: ${{ env.archive }}
tag: ${{ github.ref }}
overwrite: true
3 changes: 2 additions & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "Thermal Comfort",
"home-assistant": "2021.12.0",
"render_readme": true
"render_readme": true,
"filename": "thermal_comfort.zip"
}

0 comments on commit db3ed18

Please sign in to comment.