Skip to content

Release Stage 1 - Scheduled Run #101

Release Stage 1 - Scheduled Run

Release Stage 1 - Scheduled Run #101

name: Release Stage 1 - Update Alpha, Beta, and Stable Dependencies, Create PRs, Merge PRs and Trigger Stage 2
on:
schedule:
# Process alpha, beta, and stable streams at 8 AM UTC daily
- cron: '0 8 * * *'
workflow_dispatch:
inputs:
release_type:
description: 'Release type to update'
required: true
type: choice
options:
- alpha
- beta
- stable
- all
default: 'alpha'
run-name: Release Stage 1 - ${{ github.event_name == 'workflow_dispatch' && format('Manual - {0}', github.event.inputs.release_type) || 'Scheduled' }} Run
concurrency:
group: release-stage-1-update-dependencies
cancel-in-progress: false
jobs:
determine-release-types:
name: Determine Release Types
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_type }}" == "all" ]]; then
echo 'matrix={"release_type":["stable","beta","alpha"]}' >> $GITHUB_OUTPUT
else
echo "matrix={\"release_type\":[\"${{ github.event.inputs.release_type }}\"]}" >> $GITHUB_OUTPUT
fi
else
# Scheduled run - process stable, beta, and alpha streams
echo 'matrix={"release_type":["stable","beta","alpha"]}' >> $GITHUB_OUTPUT
fi
update_dependencies:
name: Update ${{ matrix.release_type }} Dependencies
needs: determine-release-types
strategy:
max-parallel: 1
fail-fast: false
matrix: ${{ fromJson(needs.determine-release-types.outputs.matrix) }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Run Homebridge ${{ matrix.release_type }} Bot
id: homebridge-bot
uses: homebridge/dependency-bot@latest
with:
config_file: '.github/homebridge-${{ matrix.release_type }}-bot.json'
release_stream: ${{ matrix.release_type }}
GH_TOKEN: ${{ secrets.GH_TOKEN }} # Separate token for PR approval
- name: Log Skipped ${{ matrix.release_type }} Stage 2 Trigger
if: steps.homebridge-bot.outputs.changes_detected != 'true' || steps.homebridge-bot.outputs.auto_merge != 'true'
run: |
echo "::warning::${{ matrix.release_type }} 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.release_type }} 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_release.yml'
ref: 'latest'
release-type: ${{ matrix.release_type }}
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' }} - ${{ matrix.release_type }}
- name: Cleanup older beta and alpha release and tags
if: ${{ matrix.release_type != 'stable' }}
uses: ./.github/actions/cleanup-old-releases-and-tags
with:
github-token: ${{ secrets.GH_TOKEN }}
release-type: ${{ matrix.release_type }}
releases-to-keep: 5
validate_apt_channels:
name: Post Release Validation of all APT Release Channels
needs: update_dependencies
if: always()
strategy:
matrix:
release_channel: [stable, beta, alpha]
uses: ./.github/workflows/reusable-validate-homebridge.yml
with:
validation_type: apt
release_channel: ${{ matrix.release_channel }}