Skip to content
This repository has been archived by the owner on May 28, 2022. It is now read-only.

Commit

Permalink
Create release.yml (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Jun 1, 2021
1 parent c5a00d0 commit 91c7dfc
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 4 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,57 @@
# This GitHub action workflow is meant to be copyable to any repo that have the same structure.
# - Your integration exist under custom_components/{INTEGRATION_NAME}/[integration files]
# - You are using GitHub releases to publish new versions

name: Release Workflow

on:
release:
types: [published]

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout the repository
uses: actions/checkout@v2

- name: 🔢 Get release version
id: version
uses: home-assistant/actions/helpers/version@master

- name: ℹ️ Get integration information
id: information
run: |
name=$(find custom_components/ -type d -maxdepth 1 | tail -n 1 | cut -d "/" -f2)
echo "::set-output name=name::$name"
- name: 🖊️ Set version number
run: |
jq '.version = "${{ steps.version.outputs.version }}"' \
"${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/manifest.json" > tmp \
&& mv -f tmp "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/manifest.json"
- name: 👀 Validate data
run: |
manifestversion=$(jq -r '.version' ${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/manifest.json)
if [ "$manifestversion" != "${{ steps.version.outputs.version }}" ]; then
echo "The version in custom_components/${{ steps.information.outputs.name }}/manifest.json was not correct"
echo "$manifestversion"
exit 1
fi
- name: 📦 Create zip file for the integration
run: |
cd "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}"
zip ${{ steps.information.outputs.name }}.zip -r ./
- name: 📤 Upload the zip file as a release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "${{ github.workspace }}/custom_components/${{ steps.information.outputs.name }}/${{ steps.information.outputs.name }}.zip"
asset_name: ${{ steps.information.outputs.name }}.zip
asset_content_type: application/zip
7 changes: 3 additions & 4 deletions custom_components/combined/manifest.json
Expand Up @@ -2,9 +2,8 @@
"domain": "combined",
"name": "Camera combined",
"documentation": "https://github.com/custom-components/combined",
"dependencies": [],
"version": "0.0.0",
"codeowners": [
"@ludeeus"
],
"requirements": []
}
]
}

0 comments on commit 91c7dfc

Please sign in to comment.