1111 - ' *'
1212 tags :
1313 # normal versions
14- - " v?[0-9]+.[0-9]+.[0-9]+"
14+ - ' v?[0-9]+.[0-9]+.[0-9]+'
1515 # pre-releases
16- - " v?[0-9]+.[0-9]+.[0-9]+-**"
16+ - ' v?[0-9]+.[0-9]+.[0-9]+-**'
1717 pull_request : {}
1818
19- permissions :
20- id-token : write # Required for OIDC
21- contents : read
19+ # Cancel previous PR/branch runs when a new commit is pushed
20+ concurrency :
21+ group : ${{ github.ref }}
22+ cancel-in-progress : true
2223
2324jobs :
2425 # Performs quick checks before the expensive test runs
@@ -28,127 +29,61 @@ jobs:
2829 runs-on : ubuntu-latest
2930
3031 steps :
31- - uses : actions/checkout@v6
32- - name : Use Node.js 22.x
33- uses : actions/setup-node@v6
32+ - uses : ioBroker/testing-action-check@v1
3433 with :
35- node-version : 22.x
36-
37-
38- - name : Install Dependencies
39- run : npm ci
40-
41- # - name: Perform a type check
42- # run: npm run check:ts
43- # env:
44- # CI: true
45- - name : Lint code
46- run : npm run lint
47- # - name: Test package files
48- # run: npm run test:package
34+ node-version : ' 22.x'
35+ # Uncomment the following line if your adapter cannot be installed using 'npm ci'
36+ # install-command: 'npm install'
37+ lint : true
4938
5039 # Runs adapter tests on all supported node versions and OSes
5140 adapter-tests :
5241 if : contains(github.event.head_commit.message, '[skip ci]') == false
5342
5443 needs : [check-and-lint]
5544
56- runs-on : ${{ matrix.os }}
45+ runs-on : ubuntu-latest
5746 strategy :
5847 matrix :
59- node-version : [18.x, 20.x, 22.x, 24.x]
60- os : [ubuntu-latest, windows-latest, macos-latest]
48+ node-version : [20.x, 22.x, 24.x]
6149
6250 steps :
63- - uses : actions/checkout@v6
64- - name : Use Node.js ${{ matrix.node-version }}
65- uses : actions/setup-node@v6
51+ - uses : ioBroker/testing-action-adapter@v1
6652 with :
53+ build : true
54+ os : ' ubuntu-latest'
6755 node-version : ${{ matrix.node-version }}
6856
69- - name : Install Dependencies
70- run : npm ci
71-
72- - name : Run local tests
73- run : npm test
74- # - name: Run unit tests
75- # run: npm run test:unit
76- # - name: Run integration tests # (linux/osx)
77- # if: startsWith(runner.OS, 'windows') == false
78- # run: DEBUG=testing:* npm run test:integration
79- # - name: Run integration tests # (windows)
80- # if: startsWith(runner.OS, 'windows')
81- # run: set DEBUG=testing:* & npm run test:integration
82-
8357 # Deploys the final package to NPM
8458 deploy :
85- needs : [adapter-tests]
59+ needs : [check-and-lint, adapter-tests]
8660
87- # Trigger this step only when a commit on master is tagged with a version number
61+ # Permissions are required to create GitHub releases and npm trusted publishing
62+ permissions :
63+ contents : write
64+ id-token : write
65+
66+ # Trigger this step only when a commit on any branch is tagged with a version number
8867 if : |
8968 contains(github.event.head_commit.message, '[skip ci]') == false &&
9069 github.event_name == 'push' &&
91- startsWith(github.ref, 'refs/tags/')
70+ startsWith(github.ref, 'refs/tags/v')
71+
9272 runs-on : ubuntu-latest
9373
9474 steps :
95- - name : Checkout code
96- uses : actions/checkout@v6
97-
98- - name : Use Node.js 22.x
99- uses : actions/setup-node@v6
100- with :
101- node-version : 22.x
102-
103- - name : Extract the version and commit body from the tag
104- id : extract_release
105- # The body may be multiline, therefore we need to escape some characters
106- run : |
107- VERSION="${{ github.ref }}"
108- VERSION=${VERSION##*/}
109- VERSION=${VERSION##*v}
110- echo "::set-output name=VERSION::$VERSION"
111- BODY=$(git show -s --format=%b)
112- BODY="${BODY//'%'/'%25'}"
113- BODY="${BODY//$'\n'/'%0A'}"
114- BODY="${BODY//$'\r'/'%0D'}"
115- echo "::set-output name=BODY::$BODY"
116-
117- - name : Install Dependencies
118- run : npm ci
119-
120- # - name: Create a clean build
121- # run: npm run build
122- - name : Publish package to npm
123- run : |
124- npm install -g npm@latest
125- npm -v
126- npm whoami
127- npm publish
128-
129- - name : Create Github Release
130- uses : actions/create-release@v1
131- env :
132- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
75+ - uses : ioBroker/testing-action-deploy@v1
13376 with :
134- tag_name : ${{ github.ref }}
135- release_name : Release v${{ steps.extract_release.outputs.VERSION }}
136- draft : false
137- # Prerelease versions create pre-releases on GitHub
138- prerelease : ${{ contains(steps.extract_release.outputs.VERSION, '-') }}
139- body : ${{ steps.extract_release.outputs.BODY }}
140-
141- - name : Notify Sentry.io about the release
142- run : |
143- npm i -g @sentry/cli
144- export SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
145- export SENTRY_URL=https://sentry.iobroker.net
146- export SENTRY_ORG=iobroker
147- export SENTRY_PROJECT=iobroker-sonoff
148- export SENTRY_VERSION=iobroker.sonoff@${{ steps.extract_release.outputs.VERSION }}
149- sentry-cli releases new $SENTRY_VERSION
150- sentry-cli releases set-commits $SENTRY_VERSION --auto
151- sentry-cli releases finalize $SENTRY_VERSION
152-
153- # Add the following line BEFORE finalize if sourcemap uploads are needed
154- # sentry-cli releases files $SENTRY_VERSION upload-sourcemaps build/
77+ node-version : ' 22.x'
78+ build : true
79+ # Uncomment the following line if your adapter cannot be installed using 'npm ci'
80+ # install-command: 'npm install'
81+ # npm-token: ${{ secrets.NPM_TOKEN }}
82+ github-token : ${{ secrets.GITHUB_TOKEN }}
83+ sentry : true
84+ sentry-token : ${{ secrets.SENTRY_AUTH_TOKEN }}
85+ sentry-url : https://sentry.iobroker.net
86+ sentry-org : iobroker
87+ sentry-project : iobroker-sonoff
88+ sentry-version-prefix : iobroker.sonoff
89+ sentry-sourcemap-paths : build/
0 commit comments