-
-
Notifications
You must be signed in to change notification settings - Fork 99
101 lines (92 loc) · 2.84 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches: main
paths:
- "docs/nodes/**"
- "examples/**"
- "src/**"
- "ui/**"
- "test/**"
- ".npmignore"
- "package*.json"
concurrency:
group: ci-${{ github.head_ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- 18
- 20
node-red-version:
- "^3"
- "3.1.1"
name: Tests (Node ${{ matrix.node-version }} - node-red ${{ matrix.node-red-version }})
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: pnpm install
run: pnpm install
- name: Install exact version of node-red
run: pnpm add -D node-red@${{ matrix.node-red-version }}
- name: pnpm lint
run: pnpm run lint
- name: pnpm test
run: pnpm test
env:
CI: true
release-please:
if: ${{ github.event_name == 'push' || github.event_name == 'workflow_dispatch' }}
needs: build
runs-on: ubuntu-latest
steps:
- uses: GoogleCloudPlatform/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
outputs:
release_created: ${{ steps.release.outputs.release_created }}
release_version: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
release_tag: ${{ steps.release.outputs.tag_name }}
upload-assets:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: pnpm
- name: pnpm install
run: pnpm install
- name: build
run: pnpm run build
- name: Pack
run: pnpm pack
- name: Upload Release Asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ needs.release-please.outputs.release_tag }} ./node-red-contrib-home-assistant-websocket-${{ needs.release-please.outputs.release_version }}.tgz
publish:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
uses: zachowj/node-red-contrib-home-assistant-websocket/.github/workflows/publish.yml@main
secrets: inherit
publish-documentation:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
uses: zachowj/node-red-contrib-home-assistant-websocket/.github/workflows/documentation.yml@main
secrets: inherit