Add checksum to file #37
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: ESPHome Build and Commit Manifest | |
on: | |
push: | |
branches: [main] | |
paths: | |
- 'firmware/**' # Include all files in firmware/ | |
- '!firmware/manifest.json' # Exclude manifest.json | |
- '!firmware/*.bin' | |
- .github/workflows/build.yaml #Include changes to this file | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PAT }} | |
- name: Create empty secrets file | |
run: | | |
touch firmware/secrets.yaml | |
touch firmware/conf.d/secrets.yaml | |
- name: Set git sha | |
run: echo "RELEASE_SUMMARY=$(git log -1 --pretty=%B)" >> $GITHUB_ENV | |
- name: Build ESPHome firmware | |
uses: esphome/[email protected] | |
with: | |
yaml-file: firmware/config.yaml | |
release-summary: ${{ env.RELEASE_SUMMARY }} | |
complete-manifest: true | |
release-url: "https://raw.githubusercontent.com/spuder/OpenSpool/main/firmware/manifest.json" | |
- name: List output files | |
run: | | |
ls -l openspool-esp32s2 | |
- name: Copy manifest to firmware folder | |
run: | | |
cp openspool-esp32s2/manifest.json firmware/manifest.json | |
cp openspool-esp32s2/*.bin firmware/ | |
for file in openspool-esp32s2/*.bin; do | |
md5 -q "$file" > "${file}.md5" | |
filelength=$(wc -c <"$file") | |
if [ "$filelength" -ne 3 ]; then | |
echo "md5 failed for $file" | |
exit 1 | |
fi | |
done | |
- name: Commit manifest file | |
uses: EndBug/add-and-commit@v9 | |
with: | |
committer_name: GitHub Actions | |
committer_email: [email protected] | |
message: Update manifest.json | |
add: "firmware/manifest.json firmware/*.bin firmware/*.md5" | |
push: true | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: openspool-esp32s2-${{ github.sha }} | |
path: | | |
openspool-esp32s2/*.bin | |
openspool-esp32s2/manifest.json | |
retention-days: 90 | |
cleanup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Delete old artifacts | |
uses: c-hive/gha-remove-artifacts@v1 | |
with: | |
age: '90 days' | |
skip-recent: 5 |