-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update and rename test.yml to test-and-release.yml
- Loading branch information
1 parent
5a6bf75
commit f769494
Showing
2 changed files
with
90 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: Test and Publish | ||
|
||
# Run this job on all pushes and pull requests | ||
# as well as tags with a semantic version | ||
on: | ||
push: | ||
branches: | ||
- "master" | ||
tags: | ||
# normal versions | ||
- "v[0-9]+.[0-9]+.[0-9]+" | ||
# pre-releases | ||
- "v[0-9]+.[0-9]+.[0-9]+-**" | ||
pull_request: {} | ||
|
||
# Cancel previous PR/branch runs when a new commit is pushed | ||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
# Performs quick checks before the expensive test runs | ||
check-and-lint: | ||
if: contains(github.event.head_commit.message, '[skip ci]') == false | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: ioBroker/testing-action-check@v1 | ||
with: | ||
node-version: "20.x" | ||
lint: true | ||
lint-command: "npm run lint ." | ||
|
||
adapter-tests: | ||
if: contains(github.event.head_commit.message, '[skip ci]') == false | ||
|
||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x] | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
|
||
steps: | ||
- uses: ioBroker/testing-action-adapter@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
os: ${{ matrix.os }} | ||
extra-tests: npm run test:js | ||
deploy: | ||
needs: [check-and-lint, adapter-tests] | ||
|
||
if: | | ||
contains(github.event.head_commit.message, '[skip ci]') == false && | ||
github.event_name == 'push' && | ||
startsWith(github.ref, 'refs/tags/v') | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
|
||
- name: Extract the version and commit body from the tag | ||
shell: bash | ||
id: extract_release | ||
run: | | ||
VERSION="${{ github.ref }}" | ||
VERSION=${VERSION##*/v} | ||
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | ||
EOF=$(od -An -N6 -x /dev/urandom | tr -d ' ') | ||
BODY=$(git show -s --format=%b) | ||
echo "BODY<<$EOF" >> $GITHUB_OUTPUT | ||
echo "$BODY" >> $GITHUB_OUTPUT | ||
echo "$EOF" >> $GITHUB_OUTPUT | ||
if [[ $VERSION == *"-"* ]] ; then | ||
echo "TAG=--tag next" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Publish package to npm | ||
shell: bash | ||
run: | | ||
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} | ||
npm whoami | ||
npm publish ${{ steps.extract_release.outputs.TAG }} |
This file was deleted.
Oops, something went wrong.