Skip to content

Release Workflow

Release Workflow #25

Workflow file for this run

# 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/pluggit/manifest.json" > tmp \
&& mv -f tmp "${{ github.workspace }}/custom_components/pluggit/manifest.json"
- name: πŸ‘€ Validate data
run: |
manifestversion=$(jq -r '.version' ${{ github.workspace }}/custom_components/pluggit/manifest.json)
if [ "$manifestversion" != "${{ steps.version.outputs.version }}" ]; then
echo "The version in custom_components/pluggit/manifest.json was not correct"
echo "$manifestversion"
exit 1
fi
- name: Submodule the Dantherm repository
run: git submodule add -b main https://github.com/Tvalley71/dantherm.git dantherm
- name: Copy shared code files from the Dantherm integration
run: |
cp dantherm/custom_components/dantherm/__init__.py \
dantherm/custom_components/dantherm/button.py \
dantherm/custom_components/dantherm/config_flow.py \
dantherm/custom_components/dantherm/cover.py \
dantherm/custom_components/dantherm/device.py \
dantherm/custom_components/dantherm/device_map.py \
dantherm/custom_components/dantherm/number.py \
dantherm/custom_components/dantherm/select.py \
dantherm/custom_components/dantherm/sensor.py \
dantherm/custom_components/dantherm/services.py \
dantherm/custom_components/dantherm/services.yaml \
dantherm/custom_components/dantherm/switch.py "${{ github.workspace }}/custom_components/pluggit/"
cp -r dantherm/custom_components/dantherm/translations "${{ github.workspace }}/custom_components/pluggit/translations/"
- name: πŸ”„ Replace integration name in services.yaml
run: |
sed -i 's/integration: dantherm/integration: pluggit/g' custom_components/pluggit/services.yaml
- name: Remove the Dantherm submodule
run: git rm --cached dantherm
- name: πŸ“¦ Create zip file for the integration
run: |
cd "${{ github.workspace }}/custom_components/pluggit"
zip pluggit.zip -r ./
- name: πŸ“€ Upload the zip file as a release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
with:
upload_url: "${{ github.event.release.upload_url }}"
asset_path: "${{ github.workspace }}/custom_components/pluggit/pluggit.zip"
asset_name: pluggit.zip
asset_content_type: application/zip