Skip to content

v1.4.1 - 2024-12-18 #10

v1.4.1 - 2024-12-18

v1.4.1 - 2024-12-18 #10

name: "Stage 2 - Pre-Release Validation Workflow"
on:
workflow_dispatch:
inputs:
release_tag:
description: "The tag of the release to validate."
required: true
type: string
release:
types: [prereleased]
# The workflow run trigger is a workaround due to mini-bomba/[email protected] in Stage 1 - not triggering the release event
workflow_run:
workflows: ["Stage 1 - Create a pre-release and build APT package",
"Test - Stage 1 - Create a pre-release and build APT package"]
types:
- completed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
determine_release_tag:
name: Determine Release Tag
runs-on: ubuntu-latest
outputs:
release_tag: ${{ steps.set_release_tag.outputs.release_tag }}
preRelease: ${{ steps.set_release_tag.outputs.preRelease }}
latest: ${{ steps.set_release_tag.outputs.latest }}
steps:
- name: Set Release Tag
id: set_release_tag
run: |
if [ "${{ github.event_name }}" == "release" ]; then
echo "release_tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
echo "preRelease=false" >> "$GITHUB_OUTPUT"
echo "latest=false" >> "$GITHUB_OUTPUT"
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "release_tag=${{ inputs.release_tag }}" >> "$GITHUB_OUTPUT"
echo "preRelease=false" >> "$GITHUB_OUTPUT"
echo "latest=false" >> "$GITHUB_OUTPUT"
elif [ "${{ github.event_name }}" == "workflow_run" ] && [ "${{ github.event.workflow_run.conclusion }}" == "success" ]; then
echo "release_tag=''" >> "$GITHUB_OUTPUT"
echo "preRelease=true" >> "$GITHUB_OUTPUT"
echo "latest=true" >> "$GITHUB_OUTPUT"
else
echo "::error::Unexpected event: ${{ github.event_name }}"
exit 1
fi
count_prerelease_assets:
name: Download Latest Pre-Release Assets
runs-on: ubuntu-latest
needs: determine_release_tag
steps:
- name: Download prerelease assets
id: download_assets
uses: robinraju/[email protected]
with:
tag: ${{ needs.determine_release_tag.outputs.release_tag }}
preRelease: ${{ needs.determine_release_tag.outputs.preRelease }}
latest: ${{ needs.determine_release_tag.outputs.latest }}
fileName: 'homebridge*.deb'
- name: List the downloaded files
run: ls -l
- name: Check the number of downloaded files
id: check_file_count
run: |
FILE_COUNT=$(ls -1 | wc -l)
echo "Number of files downloaded: $FILE_COUNT"
if [ "$FILE_COUNT" -ne 3 ]; then
echo "::error::Expected 3 files, but found $FILE_COUNT"
exit 1
fi
validate_prerelease_x86_package:
needs: [determine_release_tag, count_prerelease_assets]
name: Download, Install, and Validate Homebridge Package
runs-on: ubuntu-latest
steps:
- name: Download release asset
id: download_release
uses: robinraju/[email protected]
with:
tag: ${{ needs.determine_release_tag.outputs.release_tag }}
preRelease: ${{ needs.determine_release_tag.outputs.preRelease }}
latest: ${{ needs.determine_release_tag.outputs.latest }}
fileName: 'homebridge_*_amd64.deb'
- name: List downloaded files
run: |
echo "Downloaded files:"
ls -l
- name: Install the downloaded package
run: |
sudo dpkg -i homebridge_*_amd64.deb || sudo apt-get install -f -y
sleep 30
- name: Validate Homebridge Service
run: |
sudo hb-service view
sudo hb-service status
print_context:
runs-on: ubuntu-latest
steps:
- name: Dump Inputs context
env:
INPUTS_CONTEXT: ${{ toJson(inputs) }}
run: echo "$INPUTS_CONTEXT"
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump job context
env:
JOB_CONTEXT: ${{ toJson(job) }}
run: echo "$JOB_CONTEXT"
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
- name: Dump runner context
env:
RUNNER_CONTEXT: ${{ toJson(runner) }}
run: echo "$RUNNER_CONTEXT"
- name: Dump strategy context
env:
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
run: echo "$STRATEGY_CONTEXT"
- name: Dump matrix context
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
run: echo "$MATRIX_CONTEXT"
- name: Show default environment variables
run: |
echo "The job_id is: $GITHUB_JOB"
echo "The id of this action is: $GITHUB_ACTION"
echo "The run id is: $GITHUB_RUN_ID"
echo "The GitHub Actor's username is: $GITHUB_ACTOR"
echo "GitHub SHA: $GITHUB_SHA"