-
Notifications
You must be signed in to change notification settings - Fork 1
51 lines (43 loc) · 1.83 KB
/
release.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# 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: 🖊️ Set version number
run: |
jq '.version = "${{ steps.version.outputs.version }}"' \
"${{ github.workspace }}/custom_components/dantherm/manifest.json" > tmp \
&& mv -f tmp "${{ github.workspace }}/custom_components/dantherm/manifest.json"
- name: 👀 Validate data
run: |
manifestversion=$(jq -r '.version' ${{ github.workspace }}/custom_components/dantherm/manifest.json)
if [ "$manifestversion" != "${{ steps.version.outputs.version }}" ]; then
echo "The version in custom_components/dantherm/manifest.json was not correct"
echo "$manifestversion"
exit 1
fi
- name: 📦 Create zip file for the integration
run: |
cd "${{ github.workspace }}/custom_components/dantherm"
zip dantherm.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/dantherm/dantherm.zip"
asset_name: dantherm.zip
asset_content_type: application/zip