Skip to content

Build and Publish

Build and Publish #10

---
name: Build and Publish
on:
release:
types: [published]
workflow_dispatch:
inputs:
dry_run:
type: boolean
default: false
required: false
description: "Dry Run: Don't actually deploy to github-pages"
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
build:
uses: ./.github/workflows/build.yml
with:
upload-artifacts: true
consolidate-manifests:
name: Consolidate ${{ matrix.appliance.shorthand }} manifests
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
appliance:
- name: PWR-1
shorthand: pwr-1
fail-fast: false
steps:
- name: Download built firmwares
uses: actions/download-artifact@v4
with:
path: firmwares
- name: Dump Files
run: |-
ls -R firmwares
- name: Copy files
run: |-
mkdir output
- name: Consolidate manifests
run: |-
jq -s '{"name": "esphome-apollo", "new_install_improv_wait_time": 15, "new_install_prompt_erase": false, "version": "${{ github.ref_name }}", "home_assistant_domain": "esphome", "builds":.}' firmwares/*/apollo-${{ matrix.appliance.shorthand }}-*/manifest.json > output/apollo-${{ matrix.appliance.shorthand }}.json
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: apollo-${{ matrix.appliance.shorthand }}
path: output
retention-days: 7
consolidate:
name: Consolidate firmwares
runs-on: ubuntu-latest
needs: consolidate-manifests
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Download built firmwares
uses: actions/download-artifact@v4
with:
path: firmwares
- name: Dump Files
run: |-
ls -R firmwares
- name: Copy files
run: |-
mkdir output
cp -R firmwares/*/* output/
ls -R output/
- name: Copy Index
run: |-
cp index.html output/index.html
ls -R output/
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: output
deploy:
if: ${{ ! inputs.dry_run }}
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
needs: consolidate
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4