More fixes #1688
This file contains hidden or 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
| # Sample workflow for building and deploying a VitePress site to GitHub Pages | |
| # | |
| name: Deploy Docs and ESPHome Firmware to Pages | |
| on: | |
| workflow_dispatch: | |
| push: | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| build-docs: | |
| name: Build VitePress docs | |
| uses: ./.github/workflows/build-docs.yml | |
| prepare-release: | |
| runs-on: ubuntu-latest | |
| name: Prepare release data | |
| outputs: | |
| release_summary: ${{ steps.generate-summary.outputs.summary }} | |
| release_url: ${{ steps.generate-summary.outputs.url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Generate Release Data | |
| id: generate-summary | |
| run: | | |
| GITHUB_REF_NAME=${{ github.ref_name }} | |
| SHA=${{ github.sha }} | |
| CHANGELOG_FILE="docs/en/changelog/firmware.md" | |
| VERSION=$(awk '/project:/, /version:/' firmware/packages/common/base.yaml | grep 'version:' | awk '{print $2}' | sed 's/[",]//g') | |
| if [[ "${GITHUB_REF_NAME}" == "dev" ]] || [[ "${GITHUB_REF_NAME}" == dev* ]]; then | |
| URL="https://dev.doorman.azon.ai/changelog/firmware" | |
| else | |
| URL="https://doorman.azon.ai/changelog/firmware" | |
| fi | |
| # Extract content from the section matching the version | |
| RELEASE_BLOCK=$(awk -v version="## $VERSION" ' | |
| $0 ~ "^"version {flag=1; next} | |
| /^## / && $0 != version {flag=0} | |
| flag | |
| ' "$CHANGELOG_FILE") | |
| if [[ "${GITHUB_REF_NAME}" != "master" ]]; then | |
| RELEASE_BLOCK=$(echo "$RELEASE_BLOCK" | sed 's/doorman\.azon\.ai/dev.doorman.azon.ai/g') | |
| fi | |
| # Reduce heading levels safely using placeholders | |
| RELEASE_BLOCK=$(echo "$RELEASE_BLOCK" | \ | |
| sed -e 's/^#### /<h4>/' \ | |
| -e 's/^### /<h3>/' \ | |
| -e 's/^## /<h2>/') | |
| # Replace placeholders with the reduced heading levels | |
| RELEASE_BLOCK=$(echo "$RELEASE_BLOCK" | \ | |
| sed -e 's/<h4>/### /' \ | |
| -e 's/<h3>/## /' \ | |
| -e 's/<h2>/# /') | |
| # Write the clean summary to the output file without extra escaping | |
| echo "url=$URL" >> $GITHUB_OUTPUT | |
| echo "summary<<EOF" >> $GITHUB_OUTPUT | |
| echo "$RELEASE_BLOCK" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| build-webserver: | |
| name: Build Webserver JS Bundle | |
| uses: ./.github/workflows/build-webserver.yml | |
| build-firmware: | |
| name: Build ${{ matrix.chip }} ${{ matrix.variant }} (${{ matrix.integration }}) | |
| uses: ./.github/workflows/build-esphome.yml | |
| needs: [prepare-release, build-webserver] | |
| strategy: | |
| matrix: | |
| chip: [esp32, esp32-s3, esp32-s3-quad, doorman-s3, doorman-s3-rev2, doorman-s3-rev2-audio] | |
| variant: [standard, nuki-bridge] | |
| integration: [ha, mqtt, homekit, custom] | |
| exclude: | |
| # MQTT and HomeKit are incompatible with Nuki Bridge | |
| - variant: nuki-bridge | |
| integration: mqtt | |
| - variant: nuki-bridge | |
| integration: homekit | |
| with: | |
| files: firmware/configurations/${{ matrix.chip }}.${{ matrix.integration }}.${{ matrix.variant }}.${{ github.ref_name == 'master' && 'master' || 'dev' }}.factory.yaml | |
| name: Doorman ${{ matrix.variant == 'nuki-bridge' && 'Nuki-Bridge' || 'Standard' }} for ${{ matrix.integration == 'ha' && 'Home Assistant' || matrix.integration == 'mqtt' && 'MQTT' || matrix.integration == 'homekit' && 'HomeKit' || matrix.integration == 'custom' && 'Standalone Integration' || matrix.integration }} | |
| esphome_version: ${{ github.ref_name == 'master' && 'latest' || 'dev' }} | |
| directory_name: ${{ matrix.chip }}.${{ matrix.integration }}.${{ matrix.variant }} | |
| summary: ${{ needs.prepare-release.outputs.release_summary }} | |
| url: ${{ needs.prepare-release.outputs.release_url }} | |
| # Bundle all assets for Pages | |
| bundle-assets: | |
| name: Create asset bundle | |
| uses: ./.github/workflows/bundle-assets.yml | |
| needs: [build-docs, build-firmware, build-webserver] | |
| # Deployment job | |
| deploy-pages: | |
| if: github.ref_name == 'master' | |
| name: Deploy to Github Pages | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| needs: [bundle-assets] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 | |
| deploy-dev: | |
| if: startsWith(github.ref_name, 'dev') | |
| name: Deploy to Dev Server | |
| environment: | |
| name: dev.doorman.azon.ai | |
| url: "https://dev.doorman.azon.ai/" | |
| needs: [bundle-assets] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download Assets | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: asset-bundle | |
| path: output | |
| - name: Deploy via SSH | |
| uses: SamKirkland/web-deploy@v1 | |
| with: | |
| target-server: dev.doorman.azon.ai | |
| remote-user: ${{ secrets.AZON_USERNAME }} | |
| private-ssh-key: ${{ secrets.AZON_SSH_KEY }} | |
| source-path: ./output/ | |
| destination-path: ${{ secrets.AZON_PATH }} | |
| ssh-port: ${{ secrets.AZON_SSH_PORT }} | |
| deploy-experimental: | |
| if: github.ref_name != 'master' && startsWith(github.ref_name, 'dev') == false | |
| name: Deploy to Experimental Server | |
| environment: | |
| name: experimental.doorman.azon.ai | |
| url: "https://experimental.doorman.azon.ai/" | |
| needs: [bundle-assets] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download Assets | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: asset-bundle | |
| path: output | |
| - name: Deploy via SSH | |
| uses: SamKirkland/web-deploy@v1 | |
| with: | |
| target-server: experimental.doorman.azon.ai | |
| remote-user: ${{ secrets.AZON_USERNAME }} | |
| private-ssh-key: ${{ secrets.AZON_SSH_KEY }} | |
| source-path: ./output/ | |
| destination-path: ${{ secrets.AZON_PATH_EXPERIMENTAL }} | |
| ssh-port: ${{ secrets.AZON_SSH_PORT }} |