Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

release

release #64

Workflow file for this run

---
name: Release
# yamllint disable-line rule:truthy
on:
repository_dispatch:
types: [ release ]
# client_payload:
# dist-tag: latest | beta | alpha
jobs:
information:
name: ℹ️ Addon Information
runs-on: ubuntu-latest
outputs:
name: ${{ steps.information.outputs.name }}
description: ${{ steps.information.outputs.description }}
target: ${{ steps.information.outputs.target }}
build: ${{ steps.information.outputs.build }}
architectures: ${{ steps.information.outputs.architectures }}
dist-tag: ${{ steps.versions.outputs.dist-tag }}
version: ${{ steps.versions.outputs.version }}-${{github.run_number}}
matterbridge-home-assistant-version: ${{ steps.versions.outputs.version }}
steps:
- name: ⤵️ Checkout
uses: actions/checkout@v4
- name: ℹ️ Gather Information
id: information
uses: frenck/action-addon-information@v1.4.2
- name: ℹ️ Detect Versions
id: versions
run: |
DIST_TAG=${{ github.event.client_payload.dist-tag }}
VERSION=$(npm view matterbridge-home-assistant@$DIST_TAG version)
echo "dist-tag=${DIST_TAG}" >> "$GITHUB_OUTPUT"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
release:
name: 🚀 Release
runs-on: ubuntu-latest
needs: [ information ]
permissions:
contents: write
outputs:
ref: ${{ steps.changes.outputs.ref }}
steps:
- name: ⤵️ Checkout
uses: actions/checkout@v4
- name: ⛭ Setup Git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: 🚀 Perform Changes
id: changes
env:
VERSION: ${{ needs.information.outputs.version }}
run: |
yq -i e ".version = \"$VERSION\"" ${{ needs.information.outputs.target }}/config.yaml
git add .
git commit -m "chore: release $VERSION"
git push
echo "ref=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: 🚀 Create Prerelease
if: needs.information.outputs.dist-tag != 'latest'
env:
VERSION: ${{ needs.information.outputs.version }}
NOTES: |
This Addon bundles version ${{ needs.information.outputs.matterbridge-home-assistant-version }} of
`matterbridge-home-assistant`.
For detailed information about updates, please refer to its
[release notes](https://github.com/t0bst4r/matterbridge-home-assistant/releases).
REF: ${{ steps.changes.outputs.ref }}
GH_TOKEN: ${{ github.token }}
run: |
gh release create "v$VERSION" --title "v$VERSION" --latest=false --prerelease --notes "$NOTES" --target "$REF"
- name: 🚀 Create Release
if: needs.information.outputs.dist-tag == 'latest'
env:
VERSION: ${{ needs.information.outputs.version }}
NOTES: |
This Addon bundles version ${{ needs.information.outputs.matterbridge-home-assistant-version }} of
`matterbridge-home-assistant`.
For detailed information about updates, please refer to its
[release notes](https://github.com/t0bst4r/matterbridge-home-assistant/releases).
REF: ${{ steps.changes.outputs.ref }}
GH_TOKEN: ${{ github.token }}
run: |
gh release create "v$VERSION" --title "v$VERSION" --latest --notes "$NOTES" --target "$REF"
build:
name: 🚀 Build
needs: [ information, release ]
uses: ./.github/workflows/workflow__docker-build.yaml
permissions:
packages: write
strategy:
matrix:
architecture: ${{ fromJson(needs.information.outputs.architectures) }}
with:
git-ref: ${{ needs.release.outputs.ref }}
docker-push: true
addon-architecture: ${{ matrix.architecture }}
addon-path: ${{ needs.information.outputs.target }}
addon-version: ${{ needs.information.outputs.version }}
addon-name: ${{ needs.information.outputs.name }}
addon-description: ${{ needs.information.outputs.description }}
docker-tags: |
ghcr.io/${{ github.repository }}/${{ matrix.architecture }}:${{ needs.information.outputs.dist-tag }}
ghcr.io/${{ github.repository }}/${{ matrix.architecture }}:${{ needs.information.outputs.version }}
matterbridge-home-assistant-version: ${{ needs.information-outputs.matterbridge-home-assistant-version }}
secrets:
docker-token: ${{ secrets.GITHUB_TOKEN }}