Skip to content

Commit 5efd296

Browse files
authored
chore: trigger zigbee2mqtt update_dep workflow on package published (#46)
1 parent 44de7c6 commit 5efd296

File tree

2 files changed

+49
-1
lines changed

2 files changed

+49
-1
lines changed

.github/workflows/publish.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
publish:
1212
runs-on: ubuntu-latest
1313
permissions:
14-
contents: read
14+
contents: write
1515
id-token: write
1616
steps:
1717
- uses: actions/checkout@v4
@@ -27,3 +27,17 @@ jobs:
2727
- run: npm publish --provenance --access public
2828
env:
2929
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
30+
31+
- run: sleep 30s
32+
33+
- run: |
34+
npm_package=$(node -p 'require("./package.json").name')
35+
npm_version=$(node -p 'require("./package.json").version')
36+
37+
curl -L \
38+
-X POST \
39+
-H "Accept: application/vnd.github+json" \
40+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
41+
-H "X-GitHub-Api-Version: 2022-11-28" \
42+
https://api.github.com/repos/Koenkk/zigbee2mqtt/dispatches \
43+
-d '{ "event_type": "update_dep", "client_payload": { "package": "$npm_package", "version": "$npm_version" } }'
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Trigger Z2M update_dep workflow
2+
3+
on:
4+
workflow_dispatch:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
id-token: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
# Setup .npmrc file to publish to npm
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version-file: 'package.json'
22+
registry-url: 'https://registry.npmjs.org'
23+
24+
- run: |
25+
npm_package=$(node -p 'require("./package.json").name')
26+
npm_version=$(node -p 'require("./package.json").version')
27+
28+
curl -L \
29+
-X POST \
30+
-H "Accept: application/vnd.github+json" \
31+
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
32+
-H "X-GitHub-Api-Version: 2022-11-28" \
33+
https://api.github.com/repos/Koenkk/zigbee2mqtt/dispatches \
34+
-d '{ "event_type": "update_dep", "client_payload": { "package": "$npm_package", "version": "$npm_version" } }'

0 commit comments

Comments
 (0)