Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!--
From Core.yaml. Should match date YY.MM.DD.# ( Usually # is 1 )
-->
Version:

<!--
You are amazing! Thanks for contributing to our project!
Please, DO NOT DELETE ANY TEXT from this template! (unless instructed).
-->
## What does this implement/fix?



## Types of changes
<!--
What type of change does your PR introduce?
NOTE: Please, check only 1! box!
If your PR requires multiple boxes to be checked, you'll most likely need to
split it into multiple PRs. This makes things easier and faster to code review.
-->

- [ ] 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:
<!--
Put an x in the boxes that apply. You can also fill these out after
creating the PR. If you're unsure about any of them, don't hesitate to ask.
We're here to help! This is simply a reminder of what we are going to look
for before merging your code.
-->

- [ ] 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

<!--
Thank you for contributing <3
-->


34 changes: 34 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
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

[Releases](https://github.com/ApolloAutomation/PLT-1/releases)
3 changes: 2 additions & 1 deletion .github/workflows/autoassign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ jobs:
pull-requests: write
steps:
- name: 'Auto-assign issue'
uses: pozil/auto-assign-issue@v1
uses: pozil/auto-assign-issue@v2
if: github.event.pull_request.user.login != 'TrevorSchirmer'
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
assignees: TrevorSchirmer
Expand Down
226 changes: 226 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
name: Publish
env:
DEVICE_NAME: plt-1

on:
push:
branches:
- main

jobs:
check-for-yaml:
name: Check for YAML Changes
runs-on: ubuntu-latest
outputs:
yaml_changed: ${{ steps.check.outputs.yaml_changed }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2 # So we can diff the previous commit

- name: Find .yaml Changes in Last PR Merge
id: check
run: |
BASE_COMMIT=$(git rev-parse HEAD^1)
MERGE_COMMIT=$(git rev-parse HEAD)

if git diff --name-only $BASE_COMMIT $MERGE_COMMIT | grep -q '\.yaml$'; then
echo "yaml_changed=true" >> $GITHUB_OUTPUT
else
echo "yaml_changed=false" >> $GITHUB_OUTPUT
fi

set-version:
name: Set Version
runs-on: ubuntu-latest
needs: [check-for-yaml]
if: needs.check-for-yaml.outputs.yaml_changed == 'true'

# Expose job-level outputs so other jobs can access them
outputs:
version: ${{ steps.read_version.outputs.version }}
upload_url: ${{ steps.run-release-drafter.outputs.upload_url }}
body: ${{ steps.run-release-drafter.outputs.body }}
html_url: ${{ steps.run-release-drafter.outputs.html_url }}
permissions:
contents: write
pages: write
id-token: write
pull-requests: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Read version from YAML file
id: read_version
run: |
version=$(awk '/substitutions:/ {found=1} found && /version:/ {print $2; exit}' Integrations/ESPHome/Core.yaml | tr -d '"')
echo "version=$version" >> $GITHUB_OUTPUT
echo "Detected version: $version"

- name: Fetch Last Merged PR Body
id: last_pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_INFO=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/${{ github.repository }}/pulls?state=closed&sort=updated&direction=desc&per_page=1")
PR_BODY=$(echo "$PR_INFO" | jq -r '.[0].body')
echo "$PR_BODY" > pr_body.txt

- name: 🚀 Run Release Drafter
id: run-release-drafter
uses: release-drafter/release-drafter@v6
with:
version: ${{ steps.read_version.outputs.version }}
publish: true
tag: ${{ steps.read_version.outputs.version }}
name: Release ${{ steps.read_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build-firmware:
name: Build And Release (Firmware)
uses: esphome/workflows/.github/workflows/build.yml@main
needs:
- check-for-yaml
- set-version
if: needs.check-for-yaml.outputs.yaml_changed == 'true'
with:
files: |
Integrations/ESPHome/PLT-1.yaml
esphome-version: stable
combined-name: firmware
release-summary: ${{ needs.set-version.outputs.body }}
release-version: ${{ needs.set-version.outputs.version }}

build-firmware-b:
name: Build And Release (Firmware B)
uses: esphome/workflows/.github/workflows/build.yml@main
needs:
- check-for-yaml
- set-version
if: needs.check-for-yaml.outputs.yaml_changed == 'true'
with:
files: |
Integrations/ESPHome/PLT-1B.yaml
esphome-version: stable
combined-name: firmware-b
release-summary: ${{ needs.set-version.outputs.body }}
release-url: ${{ needs.set-version.outputs.html_url }}
release-version: ${{ needs.set-version.outputs.version }}

build-site:
name: Build Site
runs-on: ubuntu-latest
needs:
- check-for-yaml
- build-firmware
- build-firmware-b
- set-version
if: needs.check-for-yaml.outputs.yaml_changed == 'true'
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Build
uses: actions/jekyll-build-pages@v1.0.13
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-site
- build-firmware
- build-firmware-b
- set-version
if: needs.check-for-yaml.outputs.yaml_changed == 'true' && ${{ github.run_attempt == 1 }}
permissions:
contents: write
pages: write
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4

# 1) Download Firmware
- uses: actions/download-artifact@v4
with:
name: firmware
path: firmware

# 2) Download Firmware-B
- uses: actions/download-artifact@v4
with:
name: firmware-b
path: firmware-b

# 3) Zip them up
- name: Zip firmware
run: |
zip -r firmware.zip firmware
zip -r firmware-b.zip firmware-b

# 4) Upload firmware.zip as an asset
- name: Upload firmware.zip
id: upload-firmware
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Use the job-level output from set-version:
upload_url: ${{ needs.set-version.outputs.upload_url }}
asset_path: firmware.zip
asset_name: firmware.zip
asset_content_type: application/zip

# 5) Upload firmware-b.zip
- name: Upload firmware-b.zip
id: upload-firmware-b
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Use the job-level output from set-version:
upload_url: ${{ needs.set-version.outputs.upload_url }}
asset_path: firmware-b.zip
asset_name: firmware-b.zip
asset_content_type: application/zip

- name: Copy firmware and manifest
run: |-
mkdir -p output/firmware
cp -r firmware/${{ needs.build-firmware.outputs.version }}/* output/firmware/

- name: Copy firmware and manifest
run: |-
mkdir -p output/firmware-b
cp -r firmware-b/${{ needs.build-firmware-b.outputs.version }}/* output/firmware-b/

- 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
Loading