name: Release Home-Assistant-Matter-Hub on: repository_dispatch: event_name: release-hamh workflow_dispatch: inputs: version: type: string description: The release version of Home Assistant Matter Hub required: true # client_payload: # version: "3.0.0-alpha.33" env: repo_url: https://raw.githubusercontent.com/t0bst4r/home-assistant-matter-hub repo_changelog: CHANGELOG.md changelog_file: hamh/CHANGELOG.md config_file: hamh/config.yaml jobs: release: runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Get Version id: event_parser run: | if [ -n "${{ github.event.client_payload.version }}" ]; then echo "version=${{ github.event.client_payload.version }}" >> "$GITHUB_OUTPUT" elif [ -n "${{ github.event.inputs.version }}" ]; then echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT" else exit 1 fi - run: | git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - name: Copy Changelog run: | curl ${{ env.repo_url }}/v${{ steps.event_parser.outputs.version }}/${{ env.repo_changelog }} > ${{ env.changelog_file }} git add ${{ env.changelog_file }} - name: Apply release version run: | yq -i ".version = \"${{ steps.event_parser.outputs.version }}\"" ${{ env.config_file }} git add ${{ env.config_file }} - name: Publish run: | git commit -m "bumb(home-assistant-matter-hub): bumb to version ${{ steps.event_parser.outputs.version }}" git push origin main