From 1898140f648df8e5eb1d8b8441bd1bb497e8ab4a Mon Sep 17 00:00:00 2001 From: koenkk Date: Tue, 23 May 2023 12:11:44 +0200 Subject: [PATCH 1/7] Update config.yml --- .github/ISSUE_TEMPLATE/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 94d4a6343..57300464b 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,5 +1,8 @@ blank_issues_enabled: false contact_links: + - name: IMPORTANT: Check development branch changelog first!! + url: https://github.com/Koenkk/zigbee2mqtt/releases/tag/latest-dev + about: Before submitting an issue, check if the issue hasn't already been solved in the development branch. Click "Open" to see the release notes of the development branch - name: Questions/discussion url: https://github.com/Koenkk/zigbee2mqtt/discussions/new about: Ask questions, discuss about devices or show things you made From c6416c9c6141ef1098d2026c2988b28bada47419 Mon Sep 17 00:00:00 2001 From: koenkk Date: Tue, 23 May 2023 12:12:13 +0200 Subject: [PATCH 2/7] Fix config.yml --- .github/ISSUE_TEMPLATE/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 57300464b..fa2fed8d8 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,6 +1,6 @@ blank_issues_enabled: false contact_links: - - name: IMPORTANT: Check development branch changelog first!! + - name: "IMPORTANT: Check development branch changelog first!!" url: https://github.com/Koenkk/zigbee2mqtt/releases/tag/latest-dev about: Before submitting an issue, check if the issue hasn't already been solved in the development branch. Click "Open" to see the release notes of the development branch - name: Questions/discussion From 95dff212e7b3c5730b13a51345089efdd3b5832e Mon Sep 17 00:00:00 2001 From: koenkk Date: Tue, 23 May 2023 12:13:47 +0200 Subject: [PATCH 3/7] Update config.yml --- .github/ISSUE_TEMPLATE/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index fa2fed8d8..0a0840005 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,7 +2,7 @@ blank_issues_enabled: false contact_links: - name: "IMPORTANT: Check development branch changelog first!!" url: https://github.com/Koenkk/zigbee2mqtt/releases/tag/latest-dev - about: Before submitting an issue, check if the issue hasn't already been solved in the development branch. Click "Open" to see the release notes of the development branch + about: Before submitting an issue, check if the issue hasn't already been solved in the development branch. Click "Open" to see the release notes of the development branch. In case it is, read the [docs](https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html) on how to switch to the development branch. - name: Questions/discussion url: https://github.com/Koenkk/zigbee2mqtt/discussions/new about: Ask questions, discuss about devices or show things you made From 626b2c47c1e9a4ecb014c636f3a0bd1a3b352792 Mon Sep 17 00:00:00 2001 From: koenkk Date: Tue, 23 May 2023 12:15:15 +0200 Subject: [PATCH 4/7] Update config.yml --- .github/ISSUE_TEMPLATE/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 0a0840005..e75d6601d 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -2,7 +2,7 @@ blank_issues_enabled: false contact_links: - name: "IMPORTANT: Check development branch changelog first!!" url: https://github.com/Koenkk/zigbee2mqtt/releases/tag/latest-dev - about: Before submitting an issue, check if the issue hasn't already been solved in the development branch. Click "Open" to see the release notes of the development branch. In case it is, read the [docs](https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html) on how to switch to the development branch. + about: "Before submitting an issue, check if the issue hasn't already been solved in the development branch. Click 'Open' to see the release notes of the development branch. In case it is, you can read here how to switch to the development branch: https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html" - name: Questions/discussion url: https://github.com/Koenkk/zigbee2mqtt/discussions/new about: Ask questions, discuss about devices or show things you made From c0e8efcde5bd29f93907f20a68947d7bd5a2d878 Mon Sep 17 00:00:00 2001 From: koenkk Date: Wed, 24 May 2023 09:00:44 +0200 Subject: [PATCH 5/7] Add update_dependency.yml --- .github/workflows/update_dependency.yml | 35 +++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/update_dependency.yml diff --git a/.github/workflows/update_dependency.yml b/.github/workflows/update_dependency.yml new file mode 100644 index 000000000..081821a62 --- /dev/null +++ b/.github/workflows/update_dependency.yml @@ -0,0 +1,35 @@ +on: + repository_dispatch: + types: update_dependency + +permissions: {} +jobs: + update_dependency: + permissions: + contents: write + pull-requests: write + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: dev + token: ${{ secrets.GH_TOKEN }} + - uses: actions/setup-node@v3 + with: + node-version: 20 + cache: npm + - run: npm install ${{ github.event.client_payload.name }}@${{ github.event.client_payload.version }} --save-exact + - uses: peter-evans/create-pull-request@v5 + id: cpr + with: + commit-message: "fix(ignore): update ${{ github.event.client_payload.name }} to ${{ github.event.client_payload.version }}" + branch: "update_dependency_${{ github.event.client_payload.name }}" + title: Update ${{ github.event.client_payload.name }} to ${{ github.event.client_payload.version }} + - run: sleep 5 # Otherwise pull request may not exist yet causing automerge to fail + - uses: peter-evans/enable-pull-request-automerge@v3 + if: steps.cpr.outputs.pull-request-operation == 'created' + with: + token: ${{ secrets.GH_TOKEN }} + pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} + merge-method: squash From ce7f09afc68f00b2e5c028716314cc27ca013b77 Mon Sep 17 00:00:00 2001 From: koenkk Date: Wed, 24 May 2023 09:04:36 +0200 Subject: [PATCH 6/7] Update update_dependency.yml --- .github/workflows/update_dependency.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update_dependency.yml b/.github/workflows/update_dependency.yml index 081821a62..cdd90aa45 100644 --- a/.github/workflows/update_dependency.yml +++ b/.github/workflows/update_dependency.yml @@ -19,13 +19,13 @@ jobs: with: node-version: 20 cache: npm - - run: npm install ${{ github.event.client_payload.name }}@${{ github.event.client_payload.version }} --save-exact + - run: npm install ${{ github.event.client_payload.package }}@${{ github.event.client_payload.version }} --save-exact - uses: peter-evans/create-pull-request@v5 id: cpr with: - commit-message: "fix(ignore): update ${{ github.event.client_payload.name }} to ${{ github.event.client_payload.version }}" - branch: "update_dependency_${{ github.event.client_payload.name }}" - title: Update ${{ github.event.client_payload.name }} to ${{ github.event.client_payload.version }} + commit-message: "fix(ignore): update ${{ github.event.client_payload.package }} to ${{ github.event.client_payload.version }}" + branch: "update_dependency_${{ github.event.client_payload.package }}" + title: Update ${{ github.event.client_payload.package }} to ${{ github.event.client_payload.version }} - run: sleep 5 # Otherwise pull request may not exist yet causing automerge to fail - uses: peter-evans/enable-pull-request-automerge@v3 if: steps.cpr.outputs.pull-request-operation == 'created' From 1e8c3d05e54460c3ff62ee4c0dd00c9d58cc49d8 Mon Sep 17 00:00:00 2001 From: koenkk Date: Wed, 24 May 2023 13:09:38 +0200 Subject: [PATCH 7/7] chore: update ci config --- .github/workflows/ci.yml | 21 ++++---- .github/workflows/codeql.yaml | 17 ++----- .../{depsreview.yaml => deps_review.yaml} | 2 +- .github/workflows/ghcr_cleanup.yml | 4 +- .github/workflows/release_please.yml | 51 ++++++++++++++++++- .github/workflows/stale.yml | 11 ++-- .../{update_dependency.yml => update_dep.yml} | 8 +-- .github/workflows/update_deps.yml | 9 ++-- .github/workflows/update_frontend.yml | 35 ------------- .github/workflows/update_zh.yml | 35 ------------- .github/workflows/update_zhc.yml | 35 ------------- 11 files changed, 80 insertions(+), 148 deletions(-) rename .github/workflows/{depsreview.yaml => deps_review.yaml} (91%) rename .github/workflows/{update_dependency.yml => update_dep.yml} (89%) delete mode 100644 .github/workflows/update_frontend.yml delete mode 100644 .github/workflows/update_zh.yml delete mode 100644 .github/workflows/update_zhc.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81739d96f..5f8072284 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,14 @@ -name: CI +name: ci -on: [push, pull_request] +on: + pull_request: + push: + branches-ignore: + - deps/* permissions: - contents: read + contents: write + pull-requests: write jobs: ci: @@ -12,9 +17,9 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 registry-url: https://registry.npmjs.org/ - cache: 'npm' + cache: npm - name: Install dependencies run: npm ci - name: Build @@ -28,7 +33,7 @@ jobs: run: echo ${{ secrets.DOCKER_KEY }} | docker login -u koenkk --password-stdin - name: Docker login ghcr.io if: (github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' - run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u koenkk --password-stdin + run: echo ${{ secrets.GH_TOKEN }} | docker login ghcr.io -u koenkk --password-stdin - name: Docker setup - QEMU if: (github.ref == 'refs/heads/dev' || startsWith(github.ref, 'refs/tags/')) && github.event_name == 'push' uses: docker/setup-qemu-action@v2 @@ -73,7 +78,7 @@ jobs: run: | curl \ -X POST \ - -H "Authorization: token ${{ secrets.CR_PAT }}" \ + -H "Authorization: token ${{ secrets.GH_TOKEN }}" \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/zigbee2mqtt/hassio-zigbee2mqtt/actions/workflows/ci.yml/dispatches \ -d '{"ref":"master","inputs":{}}' @@ -95,8 +100,6 @@ jobs: - name: Install dependencies # --ignore-scripts prevents the serialport build which often fails on Windows run: npm ci --ignore-scripts - - name: Lint - run: npm run eslint - name: Build run: npm run build - name: Test diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index b480753f2..15f07a588 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -1,34 +1,23 @@ -name: "Code Scanning - Action" +name: codeql on: - pull_request: push: + branches: + - dev jobs: CodeQL-Build: - # CodeQL runs on ubuntu-latest, windows-latest, and macos-latest runs-on: ubuntu-latest permissions: - # required for all workflows security-events: write steps: - name: Checkout repository uses: actions/checkout@v3 - - # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below). - name: Autobuild uses: github/codeql-action/autobuild@v2 - - #- run: | - # make bootstrap - # make release - - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/depsreview.yaml b/.github/workflows/deps_review.yaml similarity index 91% rename from .github/workflows/depsreview.yaml rename to .github/workflows/deps_review.yaml index defcfabfa..93b96b47a 100644 --- a/.github/workflows/depsreview.yaml +++ b/.github/workflows/deps_review.yaml @@ -1,4 +1,4 @@ -name: 'Dependency review' +name: deps-review on: [pull_request] permissions: diff --git a/.github/workflows/ghcr_cleanup.yml b/.github/workflows/ghcr_cleanup.yml index ccb296e19..31e5789e9 100644 --- a/.github/workflows/ghcr_cleanup.yml +++ b/.github/workflows/ghcr_cleanup.yml @@ -1,7 +1,7 @@ on: workflow_dispatch: -name: GHCR cleanup +name: ghcr-cleanup permissions: {} jobs: @@ -12,7 +12,7 @@ jobs: - name: Delete untagged images uses: actions/github-script@v6 with: - github-token: ${{ secrets.CR_PAT }} + github-token: ${{ secrets.GH_TOKEN }} script: | const response = await github.request("GET /${{ env.OWNER }}/packages/container/${{ env.PACKAGE_NAME }}/versions", { per_page: ${{ env.PER_PAGE }} diff --git a/.github/workflows/release_please.yml b/.github/workflows/release_please.yml index a6dd0c1e6..c436ffeb7 100644 --- a/.github/workflows/release_please.yml +++ b/.github/workflows/release_please.yml @@ -13,9 +13,56 @@ jobs: release-please: runs-on: ubuntu-latest steps: + - uses: actions/setup-node@v3 + with: + node-version: 20 + cache: npm + - uses: google-github-actions/release-please-action@v3 with: release-type: node package-name: release-please-action - default-branch: master - token: ${{secrets.CR_PAT}} \ No newline at end of file + default-branch: dev + token: ${{secrets.GH_TOKEN}} + + # Checkout repos + - uses: actions/checkout@v3 + with: + repository: koenkk/zigbee2mqtt + path: ./z2m + - uses: actions/checkout@v3 + with: + repository: koenkk/zigbee2mqtt + path: ./z2m-master + ref: master + - uses: actions/checkout@v3 + with: + repository: koenkk/zigbee2mqtt + path: ./z2m-changelog + ref: release-please--branches--dev--components--release-please-action + + - name: Update latest-dev tag + run: | + cd z2m + git push --delete origin latest-dev + git tag latest-dev + git push origin latest-dev + - name: Update latest-dev release changelog + run: | + PR=$(echo '${{ steps.release.outputs.pr }}' | jq -r '.number') + MASTER_Z2M_VERSION=$(cat z2m-master/package.json | jq -r '.version') + MASTER_ZHC_VERSION=$(cat z2m-master/package.json | jq -r '.dependencies."zigbee-herdsman-converters"') + MASTER_ZH_VERSION=$(cat z2m-master/package.json | jq -r '.dependencies."zigbee-herdsman"') + cp z2m-changelog/CHANGELOG.md z2m + cd z2m + npm ci + node scripts/generateChangelog.js $MASTER_Z2M_VERSION $MASTER_ZHC_VERSION $MASTER_ZH_VERSION >> ../changelog + env: + GH_TOKEN: ${{secrets.GH_TOKEN}} + - uses: ncipollo/release-action@v1 + with: + bodyFile: changelog + prerelease: true + name: latest-dev + allowUpdates: true + tag: latest-dev diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 8b73dc8f6..59395bc23 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,17 +1,12 @@ -name: "Close stale issues/pull requests" +name: stale + on: schedule: - cron: "0 0 * * *" workflow_dispatch: -permissions: - contents: read - jobs: stale: - permissions: - issues: write # for actions/stale to close stale issues - pull-requests: write # for actions/stale to close stale PRs runs-on: ubuntu-latest steps: - uses: actions/stale@v8 @@ -21,5 +16,5 @@ jobs: stale-pr-message: 'This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days' days-before-stale: 30 days-before-close: 7 - operations-per-run: 500 exempt-issue-labels: dont-stale + operations-per-run: 500 diff --git a/.github/workflows/update_dependency.yml b/.github/workflows/update_dep.yml similarity index 89% rename from .github/workflows/update_dependency.yml rename to .github/workflows/update_dep.yml index cdd90aa45..65d0a1cf4 100644 --- a/.github/workflows/update_dependency.yml +++ b/.github/workflows/update_dep.yml @@ -1,10 +1,12 @@ on: repository_dispatch: - types: update_dependency + types: update_dep + +name: update-dep permissions: {} jobs: - update_dependency: + update_dep: permissions: contents: write pull-requests: write @@ -24,7 +26,7 @@ jobs: id: cpr with: commit-message: "fix(ignore): update ${{ github.event.client_payload.package }} to ${{ github.event.client_payload.version }}" - branch: "update_dependency_${{ github.event.client_payload.package }}" + branch: "deps/${{ github.event.client_payload.package }}" title: Update ${{ github.event.client_payload.package }} to ${{ github.event.client_payload.version }} - run: sleep 5 # Otherwise pull request may not exist yet causing automerge to fail - uses: peter-evans/enable-pull-request-automerge@v3 diff --git a/.github/workflows/update_deps.yml b/.github/workflows/update_deps.yml index fd7b5ca82..ff1c1fe1d 100644 --- a/.github/workflows/update_deps.yml +++ b/.github/workflows/update_deps.yml @@ -17,14 +17,15 @@ jobs: - uses: actions/checkout@v3 with: ref: dev - ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} + token: ${{ secrets.GH_TOKEN }} - uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 20 + cache: npm - run: npx npm-check-updates -u -x connect-gzip-static # connect-gzip-static only supports node 16 - run: npm install - uses: peter-evans/create-pull-request@v5 with: - commit-message: "feat(ignore): update dependencies" - branch: "update_deps" + commit-message: "fix(ignore): update dependencies" + branch: "deps/all" title: Update dependencies diff --git a/.github/workflows/update_frontend.yml b/.github/workflows/update_frontend.yml deleted file mode 100644 index c04884264..000000000 --- a/.github/workflows/update_frontend.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Update zigbee-frontend -on: - repository_dispatch: - types: update_frontend - -permissions: {} -jobs: - update_frontend: - permissions: - contents: write # to create branch (peter-evans/create-pull-request) - pull-requests: write # to create a PR (peter-evans/create-pull-request) - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: dev - ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: npm install zigbee2mqtt-frontend@${{ github.event.client_payload.version }} --save-exact - - uses: peter-evans/create-pull-request@v5 - id: cpr - with: - commit-message: "feat(ignore): update zigbee2mqtt-frontend to ${{ github.event.client_payload.version }}" - branch: "update_frontend" - title: Update zigbee-frontend to ${{ github.event.client_payload.version }} - - run: sleep 5 # Otherwise pull request may not exist yet causing automerge to fail - - uses: peter-evans/enable-pull-request-automerge@v3 - if: steps.cpr.outputs.pull-request-operation == 'created' - with: - token: ${{ secrets.CR_PAT }} - pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} - merge-method: squash diff --git a/.github/workflows/update_zh.yml b/.github/workflows/update_zh.yml deleted file mode 100644 index 1127f11de..000000000 --- a/.github/workflows/update_zh.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Update zigbee-herdsman -on: - repository_dispatch: - types: update_zh - -permissions: {} -jobs: - update_zh: - permissions: - contents: write # to create branch (peter-evans/create-pull-request) - pull-requests: write # to create a PR (peter-evans/create-pull-request) - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: dev - ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: npm install zigbee-herdsman@${{ github.event.client_payload.version }} --save-exact - - uses: peter-evans/create-pull-request@v5 - id: cpr - with: - commit-message: "feat(ignore): update zigbee-herdsman to ${{ github.event.client_payload.version }}" - branch: "update_zh" - title: Update zigbee-herdsman to ${{ github.event.client_payload.version }} - - run: sleep 5 # Otherwise pull request may not exist yet causing automerge to fail - - uses: peter-evans/enable-pull-request-automerge@v3 - if: steps.cpr.outputs.pull-request-operation == 'created' - with: - token: ${{ secrets.CR_PAT }} - pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} - merge-method: squash \ No newline at end of file diff --git a/.github/workflows/update_zhc.yml b/.github/workflows/update_zhc.yml deleted file mode 100644 index 3dc5594ed..000000000 --- a/.github/workflows/update_zhc.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Update zigbee-herdsman-converters -on: - repository_dispatch: - types: update_zhc - -permissions: {} -jobs: - update_zhc: - permissions: - contents: write # to create branch (peter-evans/create-pull-request) - pull-requests: write # to create a PR (peter-evans/create-pull-request) - - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - ref: dev - ssh-key: ${{ secrets.SSH_PRIVATE_KEY }} - - uses: actions/setup-node@v3 - with: - node-version: 18 - - run: npm install zigbee-herdsman-converters@${{ github.event.client_payload.version }} --save-exact - - uses: peter-evans/create-pull-request@v5 - id: cpr - with: - commit-message: "feat(ignore): update zigbee-herdsman-converters to ${{ github.event.client_payload.version }}" - branch: "update_zhc" - title: Update zigbee-herdsman-converters to ${{ github.event.client_payload.version }} - - run: sleep 5 # Otherwise pull request may not exist yet causing automerge to fail - - uses: peter-evans/enable-pull-request-automerge@v3 - if: steps.cpr.outputs.pull-request-operation == 'created' - with: - token: ${{ secrets.CR_PAT }} - pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} - merge-method: squash \ No newline at end of file