Update Build And Publish Action #8
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: Publish | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'The version of the firmware to build' | |
required: true | |
release: | |
types: [published] | |
jobs: | |
build-all-firmware: | |
name: Build And Release (All) | |
runs-on: ubuntu-latest | |
# We create a matrix of 4 "config" entries to build each firmware | |
strategy: | |
matrix: | |
config: | |
- name: firmware | |
files: Integrations/ESPHome/MSR-2_Factory.yaml | |
steps: | |
- uses: actions/checkout@v4 | |
# Each matrix iteration calls the same ESPHome build workflow | |
- name: Build firmware for ${{ matrix.config.name }} | |
id: build | |
uses: esphome/workflows/.github/workflows/build.yml@main | |
with: | |
files: ${{ matrix.config.files }} | |
esphome-version: stable | |
combined-name: ${{ matrix.config.name }} | |
release-summary: ${{ github.event_name == 'release' && github.event.release.body || '' }} | |
release-url: ${{ github.event_name == 'release' && github.event.release.html_url || '' }} | |
release-version: ${{ (github.event_name == 'release' && github.event.release.tag_name) | |
|| (github.event_name == 'workflow_dispatch' && inputs.version) | |
|| '' }} | |
build-site: | |
name: Build Site | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- name: Build | |
uses: actions/[email protected] | |
with: | |
source: ./static | |
destination: ./output | |
- name: Upload | |
uses: actions/upload-artifact@v4 | |
with: | |
name: site | |
path: output | |
publish: | |
name: Publish to GitHub Pages | |
runs-on: ubuntu-latest | |
needs: | |
- build-all-firmware | |
- build-site | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
# Download each firmware artifact by its "combined-name" (matrix.config.name) | |
- uses: actions/download-artifact@v4 | |
with: | |
name: firmware | |
path: firmware | |
- name: Copy firmware and manifest | |
run: |- | |
mkdir -p output/firmware | |
cp -r firmware/${{ needs.build-all-firmware.outputs.version }}/* output/firmware/ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: site | |
path: output | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
path: output | |
retention-days: 1 | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |