Skip to content

Commit

Permalink
improve ci (#4)
Browse files Browse the repository at this point in the history
- pin esphome version based on requirements.txt
- add project_version to manifest.json
- bump actions/[email protected]
- bump actions/[email protected]
  • Loading branch information
yoziru authored Jul 18, 2024
1 parent 55ea0ba commit 7296c7e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@ jobs:
- uses: actions/[email protected]
- name: Mock secrets.yaml from example
run: cp secrets.yaml.example secrets.yaml
- name: Get ESPHome version
id: get_esphome_version
# read esphome version from requirements.txt
run: |
esphome_version=$(grep esphome requirements.txt | cut -d'=' -f3)
echo "esphome_version=$esphome_version" >> "$GITHUB_OUTPUT"
- name: Build ESPHome firmware to verify configuration
uses: esphome/[email protected]
with:
yaml_file: ${{ matrix.file }}
cache: true
version: ${{ steps.get_esphome_version.outputs.esphome_version }}
34 changes: 20 additions & 14 deletions .github/workflows/publish-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ on:
required: false
type: string
default: manifest.json
esphome_version:
description: Version of ESPHome to build for.
required: false
type: string
default: latest

jobs:
prepare:
Expand All @@ -53,34 +48,45 @@ jobs:
- uses: actions/[email protected]
- name: Mock secrets.yaml from example
run: cp secrets.yaml.example secrets.yaml
- name: Get ESPHome version
id: get_esphome_version
# read esphome version from requirements.txt
run: |
esphome_version=$(grep esphome requirements.txt | cut -d'=' -f3)
echo "esphome_version=$esphome_version" >> "$GITHUB_OUTPUT"
- uses: esphome/[email protected]
id: esphome-build
with:
cache: false
cache: true
yaml_file: ${{ matrix.file }}
version: ${{ inputs.esphome_version }}
- run: |
version: ${{ steps.get_esphome_version.outputs.esphome_version }}
- name: Move generated files to output
run: |
mkdir output
mv "${{ steps.esphome-build.outputs.name }}" output/
- uses: actions/[email protected]
echo ${{ steps.esphome-build.outputs.version }} > output/version
echo ${{ steps.esphome-build.outputs.project-version }} > output/project_version
- uses: actions/[email protected]
with:
name: ${{ inputs.name }}
name: build-${{ matrix.file }}
path: output
retention-days: 1

publish:
name: Publish new firmware and website to GitHub Pages
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/[email protected]
- uses: actions/download-artifact@v3.0.2
- uses: actions/download-artifact@v4.1.7
with:
pattern: build-*
merge-multiple: true
path: output
name: ${{ inputs.name }}

- name: Create single manifest.json
run: |
jq -s '{"name": "${{ inputs.name }}", "version": "${{ needs.build.outputs.esphome-version }}", "home_assistant_domain": "esphome", "new_install_skip_erase": false, "builds":.}' output/*/manifest.json > output/${{ inputs.manifest_filename }}
version=$(cat output/project_version)
jq --arg version "$version" '{"name": "${{ inputs.name }}", "version": $version, "home_assistant_domain": "esphome", "new_install_skip_erase": false, "builds":.}' output/*/manifest.json > output/${{ inputs.manifest_filename }}
- run: cp -R static/* output

Expand Down
2 changes: 1 addition & 1 deletion packages/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ esphome:
comment: ${device_description}
project:
name: yoziru.esphome-argoclima-ir
version: "2024.06.28"
version: "2024.7.18"
libraries:
- crankyoldgit/IRremoteESP8266@^2.8.6

Expand Down

0 comments on commit 7296c7e

Please sign in to comment.