Add connectivityCheck config #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Release | |
on: | |
pull_request: | |
branches: | |
- main | |
paths: | |
- 'src/Dockerfile' | |
permissions: | |
contents: write | |
pull-requests: write | |
packages: write | |
jobs: | |
release-process: | |
name: Release Process | |
runs-on: ubuntu-latest | |
if: github.actor == 'dependabot[bot]' | |
steps: | |
- name: Process Dependabot Pull Request | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Approve and merge Dependabot PR automatically | |
gh pr review ${{ github.event.pull_request.html_url }} --approve | |
gh pr edit ${{ github.event.pull_request.html_url }} --add-label auto-merged,release | |
gh pr merge ${{ github.event.pull_request.html_url }} --merge | |
- name: Checkout Repository | |
uses: actions/checkout@v4.2.2 | |
with: | |
ref: main | |
- name: Get Dependency Metadata | |
id: metadata | |
uses: dependabot/fetch-metadata@v2.2.0 | |
- name: Determine Package Version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# Try to get version from metadata, fallback to API if not available | |
VERSION="${{ steps.metadata.outputs.new-version }}" | |
if [ -z "$VERSION" ]; then | |
VERSION=$(gh api repos/${{ steps.metadata.outputs.dependency-names }}/releases/latest --jq .tag_name) | |
fi | |
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Update Version and Changelog | |
run: | | |
# Get current version from config | |
CURRENT_VERSION=$(grep "version:" src/config.yaml | sed 's/.*: "\(.*\)"/\1/') | |
# Calculate new version (minor bump) | |
MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1) | |
MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2) | |
NEW_MINOR=$((MINOR + 1)) | |
ADDON_VERSION="$MAJOR.$NEW_MINOR" | |
echo "ADDON_VERSION=$ADDON_VERSION" >> $GITHUB_ENV | |
# Update files with new version | |
sed -i "s/version: .*/version: \"$ADDON_VERSION\"/" src/config.yaml | |
# Prepend new changelog entry | |
NEW_ENTRY="# $ADDON_VERSION\n- Update ${{ steps.metadata.outputs.dependency-names }} to ${{ env.PACKAGE_VERSION }}\n" | |
echo -e "$NEW_ENTRY$(cat src/CHANGELOG.md)" > src/CHANGELOG.md | |
- name: Commit Changes | |
run: | | |
# Configure git | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
# Commit and push changes | |
git add src/config.yaml src/CHANGELOG.md | |
git commit -m "Bump version to $ADDON_VERSION" | |
git push | |
- name: Validate Add-on Configuration | |
uses: frenck/action-addon-linter@v2.18.0 | |
with: | |
path: ./src | |
- name: Configure QEMU for Multi-arch Support | |
uses: docker/setup-qemu-action@v3.2.0 | |
with: | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3.8.0 | |
- name: Authenticate with GitHub Container Registry | |
uses: docker/login-action@v3.3.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Generate Image Name | |
run: | | |
# Convert repository name to lowercase for Docker compatibility | |
echo IMAGE_NAME="ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Build and Push Multi-arch Image | |
uses: docker/build-push-action@v6.10.0 | |
env: | |
DOCKER_BUILD_RECORD_UPLOAD: false | |
with: | |
context: ./src | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
push: true | |
provenance: false | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: | | |
${{ env.IMAGE_NAME }}:latest | |
${{ env.IMAGE_NAME }}:${{ env.ADDON_VERSION }} | |
labels: | | |
io.hass.name=${{ github.event.repository.name }} | |
io.hass.version=${{ env.ADDON_VERSION }} | |
io.hass.description=${{ github.event.repository.description }} | |
io.hass.url=https://github.com/${{ github.repository }} | |
io.hass.type=addon | |
io.hass.arch=amd64|aarch64|armhf | |
org.opencontainers.image.title=${{ github.event.repository.name }} | |
org.opencontainers.image.version=${{ env.ADDON_VERSION }} | |
org.opencontainers.image.description=${{ github.event.repository.description }} | |
org.opencontainers.image.authors=${{ github.repository_owner }} <github.com/${{ github.repository_owner }}> | |
org.opencontainers.image.vendor=${{ github.repository_owner }} <github.com/${{ github.repository_owner }}> | |
org.opencontainers.image.licenses=MIT | |
org.opencontainers.image.created=${{ github.event.repository.pushed_at }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
org.opencontainers.image.url=https://github.com/${{ github.repository }} | |
org.opencontainers.image.source=https://github.com/${{ github.repository }} | |
org.opencontainers.image.documentation=https://github.com/${{ github.repository }}/blob/main/README.md |