-
Notifications
You must be signed in to change notification settings - Fork 301
42 lines (39 loc) · 1.69 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: ci
on: [pull_request, push]
permissions:
contents: write
pull-requests: write
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
cache: npm
- name: Install dependencies
run: npm ci
- name: Lint
run: |
npm run pretty:check
npm run eslint
- name: Build
run: npm run build
- name: Test
run: npm run test-with-coverage -- --testTimeout=10000
- name: Publish new release
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
run: |
npm publish
PACKAGE=$(node -p "require('./package.json').name")
VERSION=$(node -p "require('./package.json').version")
until [ $(npm view $PACKAGE --json | jq --arg version "$VERSION" -r '.versions[] | select (. == $version)') ];
do
echo "Waiting for publish to complete"
sleep 5s
done
curl -XPOST -H "Authorization: token ${{ secrets.GH_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/koenkk/zigbee2mqtt/dispatches --data "{\"event_type\": \"update_dep\", \"client_payload\": { \"version\": \"$VERSION\", \"package\": \"$PACKAGE\"}}"
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN }}