Skip to content

Commit

Permalink
chore: update ci config
Browse files Browse the repository at this point in the history
  • Loading branch information
Koenkk committed May 24, 2023
1 parent ce7f09a commit 1e8c3d0
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 148 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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":{}}'
Expand All @@ -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
Expand Down
17 changes: 3 additions & 14 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: 'Dependency review'
name: deps-review
on: [pull_request]

permissions:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ghcr_cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
workflow_dispatch:

name: GHCR cleanup
name: ghcr-cleanup

permissions: {}
jobs:
Expand All @@ -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 }}
Expand Down
51 changes: 49 additions & 2 deletions .github/workflows/release_please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
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
11 changes: 3 additions & 8 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/update_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
35 changes: 0 additions & 35 deletions .github/workflows/update_frontend.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/update_zh.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/update_zhc.yml

This file was deleted.

0 comments on commit 1e8c3d0

Please sign in to comment.