From c1145eecc5f709853c3dca0067d752cda5360e69 Mon Sep 17 00:00:00 2001 From: Trevor Schirmer Date: Fri, 18 Jul 2025 12:00:46 -0400 Subject: [PATCH 1/2] Update CI And ReadMe --- .github/PULL_REQUEST_TEMPLATE.md | 47 +++++++++ .github/dependabot.yml | 17 ++++ .github/release-drafter.yml | 35 +++++++ .github/workflows/build.yml | 158 +++++-------------------------- .github/workflows/ci.yml | 20 +++- Integrations/ESPHome/Core.yaml | 2 +- README.md | 2 +- 7 files changed, 142 insertions(+), 139 deletions(-) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/dependabot.yml create mode 100644 .github/release-drafter.yml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..a298f9f --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,47 @@ + +Version: + + +## What does this implement/fix? + + + +## Types of changes + + +- [ ] Bugfix (fixed change that fixes an issue) +- [ ] New feature (thanks!) +- [ ] Breaking change (repair/feature that breaks existing functionality) +- [ ] Dependency Update - Does not publish +- [ ] Other - Does not publish +- [ ] Website of github readme file update - Does not publish +- [ ] Github workflows - Does not publish + + +## Checklist / Checklijst: + + + - [ ] The code change has been tested and works locally + - [ ] The code change has not yet been tested + +If user-visible functionality or configuration variables are added/modified: + - [ ] Added/updated documentation for the web page + + \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a689b1e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,17 @@ +# To get started with Dependabot version updates, you'll need to specify which + # package ecosystems to update and where the package manifests are located. + # Please see the documentation for all configuration options: + # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + + version: 2 + updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + commit-message: + prefix: "chore(ci): " + groups: + github-actions: + patterns: + - "*" \ No newline at end of file diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..15d30ad --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,35 @@ +name-template: 'Release v$NEXT_PATCH_VERSION' +tag-template: "$RESOLVED_VERSION" +change-template: "- #$NUMBER $TITLE @$AUTHOR" +sort-direction: ascending + +categories: + - title: "🚨 Breaking changes" + labels: + - "breaking-change" + - title: "✨ New features" + labels: + - "new-feature" + - title: "🐛 Bug fixes" + labels: + - "bugfix" + - title: "⬆️ Dependency updates" + collapse-after: 5 + labels: + - "dependency-update" + +include-labels: + - "bugfix" + - "new-feature" + - "breaking-change" + +no-changes-template: '- No changes' + +template: | + ## What's Changed + + $CHANGES + + **Full Changelog**: https://github.com/ApolloAutomation/MSR-1/compare/$PREVIOUS_TAG...$RESOLVED_VERSION.1 + + Be sure to 🌟 this repository for updates! \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5113c7b..1af6af1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,142 +1,36 @@ -name: Build -env: - DEVICE_NAME: msr-1 - RELEASE_URL: ${{ github.server_url }}/${{ github.repository }}/releases/latest +name: Build and Publish on: push: branches: - main + workflow_dispatch: + inputs: + bypass-yaml-check: + description: 'Bypass YAML change check (force build/publish)' + type: boolean + required: false + default: false + # release: + # types: [published] jobs: - build: - name: Build And Release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set uppercase DEVICE_NAME - run: | - echo "UPPERCASE_DEVICE_NAME=$(echo $DEVICE_NAME | tr '[:lower:]' '[:upper:]')" >> $GITHUB_ENV - - - name: Build Firmware - uses: esphome/build-action@v3.0.0 - id: esphome-build - with: - yaml_file: Integrations/ESPHome/${{ env.UPPERCASE_DEVICE_NAME }}.yaml - version: 'latest' - cache: true - - - name: Read version from YAML file - id: read_version - run: | - version=$(awk '/substitutions:/ {found=1} found && /version:/ {print $2; exit}' Integrations/ESPHome/${{ env.UPPERCASE_DEVICE_NAME }}.yaml | tr -d '"') - echo "project_version=$version" >> $GITHUB_ENV - - - name: Move generated files to output - run: | - mkdir -p output - mv ${{ steps.esphome-build.outputs.name }}/* output/ - echo ${{ steps.esphome-build.outputs.version }} > output/version - # Extract MD5 checksum of firmware.ota.bin - MD5_CHECKSUM=$(jq -r '.ota.md5' output/manifest.json) - echo "MD5_CHECKSUM=$MD5_CHECKSUM" >> $GITHUB_ENV - - # Create new manifest.json with jq - jq -n --arg name "${{ env.DEVICE_NAME }}" \ - --arg version "${{ env.project_version }}" \ - --arg md5 "$MD5_CHECKSUM" \ - '{name: $name, version: $version, home_assistant_domain: "esphome", new_install_prompt_erase: false, builds: [{chipFamily: "ESP32-C3", parts: [{path: "apollo-${{ env.DEVICE_NAME }}-esp32c3.factory.bin", offset: 0}], ota: {path: "apollo-${{ env.DEVICE_NAME }}-esp32c3.ota.bin", md5: $md5}}]}' > output/manifest.json - - - - uses: actions/upload-artifact@v4.3.3 - with: - path: output/ - retention-days: 1 - - - name: Collect merge commits - id: collect_commits - run: | - MERGE_COMMITS=$(git log --merges --pretty=format:"%h %s" $(git describe --tags --abbrev=0 @^)..@) - echo "MERGE_COMMITS=$MERGE_COMMITS" >> $GITHUB_ENV - - - name: Create Release - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} - with: - tag_name: ${{ env.project_version }} - release_name: "Release ${{ env.project_version }}" - body: Release of version ${{ env.project_version }} - - draft: false - prerelease: false - - - name: Upload firmware.factory.bin to Release - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: output/apollo-${{ env.DEVICE_NAME }}-esp32c3.factory.bin - asset_name: apollo-${{ env.DEVICE_NAME }}-esp32c3.factory.bin - asset_content_type: application/octet-stream - - - name: Upload firmware.ota.bin to Release - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: output/apollo-${{ env.DEVICE_NAME }}-esp32c3.ota.bin - asset_name: apollo-${{ env.DEVICE_NAME }}-esp32c3.ota.bin - asset_content_type: application/octet-stream - - name: Upload firmware.ota.bin to Release - if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: output/manifest.json - asset_name: manifest.json - asset_content_type: application/octet-stream - - - prep: - name: Consolidate firmwares - runs-on: ubuntu-latest - needs: - - build - steps: - - uses: actions/checkout@v4 - - uses: actions/download-artifact@v4.1.7 - with: - path: output - - run: cp -R static/* output/ - - uses: actions/upload-pages-artifact@v3.0.1 - with: - path: output - retention-days: 1 - - deploy: - if: contains(fromJSON('["workflow_dispatch", "push", "schedule"]'), github.event_name) && github.ref == 'refs/heads/main' - name: Deploy to GitHub Pages - runs-on: ubuntu-latest - needs: prep + build-and-publish: + uses: ApolloAutomation/Workflows/.github/workflows/build.yml@main permissions: + contents: write pages: write id-token: write - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - steps: - - name: Setup Pages - uses: actions/configure-pages@v5 - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4.0.5 + pull-requests: write + with: + device-name: msr-2 + yaml-files: | + Integrations/ESPHome/MSR-1_Factory.yaml + firmware-names: "_Factory:firmware" + core-yaml-path: Integrations/ESPHome/Core.yaml + esphome-version: stable + # Bypass check if manually triggered with bypass option + check-yaml-changes: ${{ !(github.event_name == 'workflow_dispatch' && github.event.inputs.bypass-yaml-check == 'true') }} + publish-to-pages: true + has-installer: true + installer-path: static diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d11a794..bc90609 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,21 @@ name: CI - on: pull_request: +permissions: + # Allow GITHUB_TOKEN to add labels to pull requests + pull-requests: write + issues: write + contents: read + id-token: write + jobs: + label-check: + name: Label Check + uses: ApolloAutomation/Workflows/.github/workflows/label-check.yml@main + ci: - name: Building ${{ matrix.file }} + name: Building ${{ matrix.file }} / ESPHome ${{ matrix.esphome-version }} runs-on: ubuntu-latest strategy: matrix: @@ -19,8 +29,8 @@ jobs: - dev steps: - name: Checkout source code - uses: actions/checkout@v4.1.7 + uses: actions/checkout@v4.2.2 - name: Build ESPHome firmware to verify configuration - uses: esphome/build-action@v3.1.0 + uses: esphome/build-action@v7 with: - yaml_file: ${{ matrix.file }} \ No newline at end of file + yaml-file: ${{ matrix.file }} \ No newline at end of file diff --git a/Integrations/ESPHome/Core.yaml b/Integrations/ESPHome/Core.yaml index e27e5ac..11df89f 100644 --- a/Integrations/ESPHome/Core.yaml +++ b/Integrations/ESPHome/Core.yaml @@ -1,5 +1,5 @@ substitutions: - version: "25.2.27.1" + version: "25.7.18.1" device_description: ${name} made by Apollo Automation - version ${version}. esp32: diff --git a/README.md b/README.md index 4ad0fd1..e994e62 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ YAML Files: - MSR-1_Factory.yaml: This is the firmware flashed by us on new devices. It contains the components for ESP improve, allowing easy adoption in Home Assistant. When you load the device in ESPHome addon, it will grab the firmware from MSR-1.yaml which no longer has the improve. Links: \ -Discord (Support/feedback/discussion/future products): [https://discord.gg/8PpS4yUaUh](https://discord.gg/mMNgQPyF94) \ +Discord (Support/feedback/discussion/future products): [https://dsc.gg/ApolloAutomation](https://dsc.gg/ApolloAutomation) \ Shop: [https://apolloautomation.com](https://apolloautomation.com) \ Wiki: [https://wiki.apolloautomation.com](https://wiki.apolloautomation.com/) \ 3D Files: [https://www.printables.com/model/564297-apollo-automation-msr-1-mmwave-co2-multisensor-for](https://www.printables.com/model/564297-apollo-automation-msr-1-mmwave-co2-multisensor-for) \ No newline at end of file From 812bda1c2fd74695abcdacf0e16af3bda2eac3eb Mon Sep 17 00:00:00 2001 From: Trevor Schirmer Date: Fri, 18 Jul 2025 12:01:38 -0400 Subject: [PATCH 2/2] Update Flashing Page --- static/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/index.html b/static/index.html index dc23922..bcf0172 100644 --- a/static/index.html +++ b/static/index.html @@ -82,7 +82,7 @@

Apollo MSR-1 Installer

- +