Compare commits

..
6 changed files with 63 additions and 22 deletions
@@ -11,7 +11,7 @@ concurrency:
cancel-in-progress: false
jobs:
platform_matrix:
build:
strategy:
matrix:
build:
@@ -36,13 +36,18 @@ jobs:
with:
app_id: ${{ secrets.RELEASE_BOT_APP_ID }}
private_key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
- run: npx semantic-release --ci
name: Semantic Release
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic # Need an `id` for output variables
env:
GH_TOKEN: ${{ steps.create_token.outputs.token }}
GITHUB_TOKEN: ${{ steps.create_token.outputs.token }}
- run: yarn build
if: steps.semantic.outputs.new_release_published == 'true'
- run: yarn prepare-release
if: steps.semantic.outputs.new_release_published == 'true'
- run: yarn package ${{ matrix.build.task }}
if: steps.semantic.outputs.new_release_published == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
+17
View File
@@ -0,0 +1,17 @@
name: Update Website
on: [release, workflow_dispatch]
jobs:
update-website:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npm install
- run: npm run readme
- uses: stefanzweifel/git-auto-commit-action@v5
+4 -3
View File
@@ -9,7 +9,7 @@ const root = protobuf.parse(protocol).root
export let SparkplugPayload = root.lookupType('com.cirruslink.sparkplug.protobuf.Payload')
export const SparkplugDecoder = {
decode(input: Buffer): Base64Message | undefined {
decode(input: Buffer): Base64Message {
try {
const message = Base64Message.fromString(
JSON.stringify(SparkplugPayload.toObject(SparkplugPayload.decode(new Uint8Array(input))))
@@ -17,8 +17,9 @@ export const SparkplugDecoder = {
message.decoder = Decoder.SPARKPLUG
return message
} catch {
// ignore
const message = Base64Message.fromString("Failed to decode sparkplugb payload")
message.decoder = Decoder.NONE
return message
}
return undefined
},
}
+9 -1
View File
@@ -47,9 +47,17 @@ export class ConnectionManager {
buffer = buffer.slice(0, 20000)
}
let decoded_payload = null
// spell-checker: disable-next-line
if (topic.match(/^spBv1\.0\/[^/]+\/[ND](DATA|CMD|DEATH|BIRTH)\/[^/]+(\/[^/]+)?$/u)) {
decoded_payload = SparkplugDecoder.decode(buffer)
} else {
decoded_payload = Base64Message.fromBuffer(buffer)
}
backendEvents.emit(messageEvent, {
topic,
payload: SparkplugDecoder.decode(buffer) ?? Base64Message.fromBuffer(buffer),
payload: decoded_payload,
qos: packet.qos,
retain: packet.retain,
messageId: packet.messageId,
+24 -14
View File
@@ -7,12 +7,30 @@ const linuxAppImage: builder.CliOptions = {
x64: true,
ia32: false,
armv7l: true,
arm64: false,
arm64: true,
projectDir: './build/clean',
publish: 'always',
}
const linuxSnap: builder.CliOptions = {
x64: true,
ia32: false,
armv7l: false, // not supported to build on x64
arm64: false, // not supported to build on x64
projectDir: './build/clean',
publish: 'always',
}
const linuxDeb: builder.CliOptions = {
x64: true,
ia32: false,
armv7l: true,
arm64: true,
projectDir: './build/clean',
publish: 'always',
}
const winPortable: builder.CliOptions = {
x64: true,
ia32: false,
armv7l: false,
@@ -21,18 +39,9 @@ const linuxSnap: builder.CliOptions = {
publish: 'always',
}
const winPortable: builder.CliOptions = {
x64: true,
ia32: true,
armv7l: false,
arm64: false,
projectDir: './build/clean',
publish: 'always',
}
const winNsis: builder.CliOptions = {
x64: true,
ia32: true,
ia32: false,
armv7l: false,
arm64: false,
projectDir: './build/clean',
@@ -41,7 +50,7 @@ const winNsis: builder.CliOptions = {
const winAppx: builder.CliOptions = {
x64: true,
ia32: true,
ia32: false,
armv7l: false,
arm64: false,
projectDir: './build/clean',
@@ -69,11 +78,12 @@ async function executeBuild() {
case 'linux':
await buildWithOptions(linuxAppImage, { platform: 'linux', package: 'AppImage' })
await buildWithOptions(linuxSnap, { platform: 'linux', package: 'snap' })
await buildWithOptions(linuxDeb, { platform: 'linux', package: 'deb' })
break
case 'mac':
await buildWithOptions(mac, { platform: 'mac', package: 'dmg' })
await buildWithOptions(mac, { platform: 'mac', package: 'mas' })
await buildWithOptions(mac, { platform: 'mac', package: 'zip' })
// await buildWithOptions(mac, { platform: 'mac', package: 'mas' })
// await buildWithOptions(mac, { platform: 'mac', package: 'zip' })
break
default:
await buildWithOptions({ ...mac, projectDir: '' }, { platform: 'mac', package: 'mas-dev' })