fix: reporting fields per spec #866
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
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| pull_request: | |
| permissions: | |
| contents: read | |
| id-token: write | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| checks: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Update NPM | |
| run: npm install -g npm@latest | |
| - run: npm ci | |
| - run: npm run check:ci | |
| - run: npm run typecheck | |
| - run: npm run build | |
| - run: npm run test:cov | |
| # build container when triggered by release (push on tag) | |
| - name: Log in to the GitHub container registry | |
| if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker setup - QEMU | |
| if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Docker setup - Buildx | |
| if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' | |
| uses: docker/setup-buildx-action@v3 | |
| - name: edge - Docker meta | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| uses: docker/metadata-action@v5 | |
| id: meta_edge | |
| with: | |
| images: | | |
| ghcr.io/nerivec/zigbee2mqtt-windfront | |
| tags: | | |
| type=edge | |
| labels: | | |
| org.opencontainers.image.authors=Nerivec | |
| org.opencontainers.image.documentation=https://github.com/Nerivec/zigbee2mqtt-windfront/wiki | |
| - name: edge - Docker build and push | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| platforms: linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7,linux/riscv64,linux/386 | |
| tags: ${{ steps.meta_edge.outputs.tags }} | |
| push: true | |
| - name: Docker meta | |
| if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' | |
| uses: docker/metadata-action@v5 | |
| id: meta | |
| with: | |
| images: | | |
| ghcr.io/nerivec/zigbee2mqtt-windfront | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| labels: | | |
| org.opencontainers.image.authors=Nerivec | |
| org.opencontainers.image.documentation=https://github.com/Nerivec/zigbee2mqtt-windfront/wiki | |
| - name: Docker build and push | |
| if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile | |
| platforms: linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7,linux/riscv64,linux/386 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| push: true | |
| - name: Publish package to npmjs.org | |
| if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' | |
| run: npm publish --provenance --access public | |
| - name: Add tarball dist to release assets | |
| if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' | |
| run: | | |
| mv dist zigbee2mqtt-windfront-${{ github.ref_name }} | |
| tar -czvf zigbee2mqtt-windfront-${{ github.ref_name }}.tar.gz zigbee2mqtt-windfront-${{ github.ref_name }} | |
| gh release upload ${{ github.ref_name }} zigbee2mqtt-windfront-${{ github.ref_name }}.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish built-main branch | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| run: | | |
| temp_dir=$(mktemp -d) | |
| cp -R dist/. $temp_dir | |
| git switch --orphan built-main | |
| rm -rf ./* | |
| cp -R $temp_dir/* . | |
| git add -A | |
| git config --local user.name 'github-actions[bot]' | |
| git config --local user.email 'github-actions[bot]@users.noreply.github.com' | |
| git commit -m "$GITHUB_SHA" || echo 'Nothing to commit' | |
| git push --force --set-upstream origin built-main | |
| - name: Trigger ha-zigbee2mqtt-windfront windfront_edge build | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| run: | | |
| curl -L \ | |
| -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.PAT }}" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| https://api.github.com/repos/Nerivec/ha-zigbee2mqtt-windfront/actions/workflows/manual-builder.yaml/dispatches \ | |
| -d '{"ref":"main","inputs":{"addon_folder":"windfront_edge"}}' | |
| - name: Create ha-zigbee2mqtt-windfront windfront bump version PR | |
| if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' | |
| run: | | |
| curl -L \ | |
| -X POST \ | |
| -H "Accept: application/vnd.github+json" \ | |
| -H "Authorization: Bearer ${{ secrets.PAT }}" \ | |
| -H "X-GitHub-Api-Version: 2022-11-28" \ | |
| https://api.github.com/repos/Nerivec/ha-zigbee2mqtt-windfront/actions/workflows/bump-version.yaml/dispatches \ | |
| -d '{"ref":"main","inputs":{"addon_folder":"windfront", "arg_name": "WINDFRONT", "version": "${{ github.ref_name }}", "changelog": "## ${{ github.ref_name }}\n\n- [WindFront release notes](https://github.com/Nerivec/zigbee2mqtt-windfront/releases/tag/${{ github.ref_name }})"}}' |