Skip to content

Commit

Permalink
Fix auto publish on version commit title
Browse files Browse the repository at this point in the history
  • Loading branch information
JovannMC committed Apr 13, 2024
1 parent de1d552 commit 57ee96c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 45 deletions.
77 changes: 35 additions & 42 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,41 @@
name: Node.js Package

on:
release:
types: [created]
push:
branches:
- '**'
paths-ignore:
- '**.md'
tags:
- 'v*.*.*'
release:
types: [created]
push:
branches:
- "**"
paths-ignore:
- "**.md"
tags:
- "v*.*.*"

jobs:
check-title:
runs-on: ubuntu-latest
steps:
- name: Check commit title
run: |
commit_title=$(git log --format=%s -n 1 ${{ github.event.after }})
if [[ ! "$commit_title" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Commit title '$commit_title' doesn't start with a semantic version number. Cancelling workflow."
exit 1
fi
check-title:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check commit title
run: |
commit_title=$(git log --format=%s -n 1 ${{ github.event.after }})
if [[ ! "$commit_title" =~ ^v[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Commit title '$commit_title' doesn't start with a semantic version number. Cancelling workflow."
exit 1
fi
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm ci

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
build-and-publish-npm:
needs: check-title
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
8 changes: 5 additions & 3 deletions src/devices/haritorax-wireless.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export default class HaritoraXWireless extends EventEmitter {
gxEnabled = false;
return true;
} else {
console.error("Error stopping GX6 connection")
console.error("Error stopping GX6 connection");
return false;
}
} else if (connectionMode === "bluetooth") {
Expand All @@ -239,7 +239,7 @@ export default class HaritoraXWireless extends EventEmitter {
bluetoothEnabled = false;
return true;
} else {
console.error("Error stopping Bluetooth connection")
console.error("Error stopping Bluetooth connection");
return false;
}
}
Expand Down Expand Up @@ -284,7 +284,9 @@ export default class HaritoraXWireless extends EventEmitter {
];

if (trackerName.startsWith("HaritoraX")) {
console.error("Setting tracker settings for bluetooth is not supported yet.");
console.error(
"Setting tracker settings for bluetooth is not supported yet."
);
return false;
} else {
log(`Setting tracker settings for ${trackerName}...`);
Expand Down

0 comments on commit 57ee96c

Please sign in to comment.