mirror of
https://github.com/RiDDiX/home-assistant-addons.git
synced 2026-07-14 12:28:09 +08:00
108 lines
3.7 KiB
YAML
108 lines
3.7 KiB
YAML
name: Release Home-Assistant-Matter-Hub
|
|
|
|
on:
|
|
repository_dispatch:
|
|
types: [release]
|
|
workflow_dispatch:
|
|
inputs:
|
|
project:
|
|
description: 'Project to release (hamh, hamh-alpha, hamh-testing)'
|
|
required: true
|
|
default: 'hamh'
|
|
version:
|
|
description: 'Version to release'
|
|
required: true
|
|
channel:
|
|
description: 'Release channel'
|
|
required: true
|
|
default: 'latest'
|
|
changelogUrl:
|
|
description: 'URL to changelog file'
|
|
required: false
|
|
|
|
# client_payload from repository_dispatch:
|
|
# project: "hamh"
|
|
# channel: "latest" | "alpha"
|
|
# version: "3.0.0"
|
|
# changelogUrl: "https://..."
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Parse Event
|
|
id: event_parser
|
|
run: |
|
|
# Handle both repository_dispatch and workflow_dispatch
|
|
if [ "${{ github.event_name }}" = "repository_dispatch" ]; then
|
|
PROJECT="${{ github.event.client_payload.project }}"
|
|
CHANNEL="${{ github.event.client_payload.channel }}"
|
|
VERSION="${{ github.event.client_payload.version }}"
|
|
CHANGELOG_URL="${{ github.event.client_payload.changelogUrl }}"
|
|
else
|
|
PROJECT="${{ github.event.inputs.project }}"
|
|
CHANNEL="${{ github.event.inputs.channel }}"
|
|
VERSION="${{ github.event.inputs.version }}"
|
|
CHANGELOG_URL="${{ github.event.inputs.changelogUrl }}"
|
|
fi
|
|
|
|
# Append channel to project name if not latest
|
|
if [ "$CHANNEL" != "latest" ]; then
|
|
PROJECT="$PROJECT-$CHANNEL"
|
|
fi
|
|
|
|
echo "project=$PROJECT" >> "$GITHUB_OUTPUT"
|
|
echo "channel=$CHANNEL" >> "$GITHUB_OUTPUT"
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
echo "changelogUrl=$CHANGELOG_URL" >> "$GITHUB_OUTPUT"
|
|
|
|
if [ ! -d "$PROJECT" ]; then
|
|
echo "Error: Project directory '$PROJECT' does not exist"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Releasing $PROJECT version $VERSION (channel: $CHANNEL)"
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
|
|
- name: Download and Update Changelog
|
|
if: steps.event_parser.outputs.changelogUrl != ''
|
|
env:
|
|
CHANGELOG_FILE: ${{ steps.event_parser.outputs.project }}/CHANGELOG.md
|
|
run: |
|
|
curl -L "${{ steps.event_parser.outputs.changelogUrl }}" > $CHANGELOG_FILE
|
|
git add $CHANGELOG_FILE
|
|
|
|
- name: Update Version in config.yaml
|
|
env:
|
|
CONFIG_FILE: ${{ steps.event_parser.outputs.project }}/config.yaml
|
|
run: |
|
|
yq -i ".version = \"${{ steps.event_parser.outputs.version }}\"" $CONFIG_FILE
|
|
git add $CONFIG_FILE
|
|
|
|
- name: Commit and Push
|
|
run: |
|
|
git commit -m "release(${{ steps.event_parser.outputs.project }}): ${{ steps.event_parser.outputs.version }}"
|
|
git push origin main
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ steps.event_parser.outputs.project }}-${{ steps.event_parser.outputs.version }}
|
|
name: ${{ steps.event_parser.outputs.project }} ${{ steps.event_parser.outputs.version }}
|
|
body: |
|
|
Release of ${{ steps.event_parser.outputs.project }} version ${{ steps.event_parser.outputs.version }}
|
|
|
|
See the main project for detailed changelog:
|
|
https://github.com/riddix/home-assistant-matter-hub/releases
|
|
generate_release_notes: false
|