Skip to content

Release Stage 1 - Dependency Management - Scheduled Run #48

Release Stage 1 - Dependency Management - Scheduled Run

Release Stage 1 - Dependency Management - Scheduled Run #48

name: Release Stage 1 - Dependency Management - Update and Build
run-name: Release Stage 1 - Dependency Management - ${{ github.event_name == 'workflow_dispatch' && format('Manual - {0}', github.event.inputs.release_stream) || 'Scheduled' }} Run
on:
schedule:
# Daily updates - 6 AM Eastern (10 AM UTC), processes stable, beta and alpha streams
- cron: '0 10 * * *'
workflow_dispatch:
inputs:
release_stream:
description: 'Choose release stream to update and build'
required: true
type: choice
options:
- stable
- beta
- alpha
- all
default: all
skip_build:
description: 'Skip build and only update dependencies'
required: false
type: boolean
default: false
concurrency:
group: release-stage-1-update-dependencies
cancel-in-progress: false
permissions:
contents: write
pull-requests: write
checks: read
actions: write
jobs:
define-matrix:
name: Define Jobs Matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Set matrix based on trigger
id: set-matrix
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
if [[ "${{ github.event.inputs.release_stream }}" == "all" ]]; then
echo 'matrix={"stream":["stable","beta","alpha"]}' >> $GITHUB_OUTPUT
else
echo "matrix={\"stream\":[\"${{ github.event.inputs.release_stream }}\"]}" >> $GITHUB_OUTPUT
fi
else
# Scheduled run - process stable, beta, and alpha streams
echo 'matrix={"stream":["stable","beta","alpha"]}' >> $GITHUB_OUTPUT
fi
- name: Output matrix for debugging
run: |
echo "::notice::Dependencies Matrix: ${{ steps.set-matrix.outputs.matrix }}"
update-dependencies:
name: Update ${{ matrix.stream }} Dependencies
needs: define-matrix
runs-on: ubuntu-latest
strategy:
max-parallel: 1
fail-fast: false
matrix:
stream: ${{ fromJson(needs.define-matrix.outputs.matrix).stream }}
steps:
- name: Update Dependencies ${{ matrix.stream }}
id: homebridge-bot
uses: homebridge/dependency-bot@latest
with:
config_file: '.github/homebridge-dependency-bot-${{ matrix.stream }}.json'
release_stream: ${{ matrix.stream }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Log Skipped ${{ matrix.stream }} Stage 2 Trigger
if: steps.homebridge-bot.outputs.changes_detected != 'true' || steps.homebridge-bot.outputs.auto_merge != 'true'
run: |
echo "::warning::${{ matrix.stream }} Stage 2 not triggered: Changes Detected=${{ steps.homebridge-bot.outputs.changes_detected }}, Auto Merge=${{ steps.homebridge-bot.outputs.auto_merge }}"
- name: Checkout repository (for trigger step)
if: steps.homebridge-bot.outputs.changes_detected == 'true' && steps.homebridge-bot.outputs.auto_merge == 'true'
uses: actions/checkout@v4
- name: Trigger and Wait for ${{ matrix.stream }} Stage 2 Workflow
if: steps.homebridge-bot.outputs.changes_detected == 'true' && steps.homebridge-bot.outputs.auto_merge == 'true'
uses: ./.github/actions/trigger-and-wait-workflow
with:
workflow-file: 'release-stage-2_build_and_push_docker_images.yml'
ref: 'latest'
release-type: ${{ matrix.stream }}
scheduled: ${{ github.event_name == 'workflow_dispatch' && 'Manual' || 'Scheduled' }}
github-token: ${{ secrets.GH_TOKEN }}
timeout-minutes: '30'
run-name: ${{ github.event_name == 'workflow_dispatch' && 'Manual' || 'Scheduled' }} - Build and Push ${{ matrix.stream }}
- name: Cleanup older beta and alpha release and tags
if: ${{ matrix.stream != 'stable' }}
uses: ./.github/actions/cleanup-old-releases-and-tags
with:
github-token: ${{ secrets.GH_TOKEN }}
release-type: ${{ matrix.stream }}
releases-to-keep: 5