Compare commits

..

6 Commits

Author SHA1 Message Date
skylord123 0362fe81e8 Merge pull request #143 from Skylar-Tech/add-publish-workflow
Add npm publish workflow
2026-05-22 16:34:57 -06:00
skylord123 9ccbe4526f Add GitHub Actions workflow to publish to npm on release 2026-05-22 16:32:09 -06:00
skylord123 aadd82d820 Set version to 0.9.2 2026-01-17 15:00:35 -07:00
skylord123 4e6fa50a67 Merge pull request #138 from Skylar-Tech/dev
Release v0.9.2
2026-01-17 14:57:45 -07:00
skylord123 c15893bab5 Merge pull request #135 from fprotopapa/master
Remove unused TimelineWindow in server-config. Closes #134
2026-01-17 14:54:45 -07:00
Fabbio Protopapa f0af0e92fe Remove unused TimelineWindow in server-config 2025-12-23 09:45:57 +01:00
3 changed files with 83 additions and 5 deletions
+81
View File
@@ -0,0 +1,81 @@
name: Publish to npm
# Publishes the package to npm whenever a GitHub Release is published.
# It publishes the exact commit the release tag points to, so a pre-release
# can be cut from any branch (e.g. a beta off `dev`) without that branch
# having to be merged into master first.
#
# The release tag is the source of truth for the version:
# - Stable tag (e.g. v1.2.3) -> published to the "latest"
# dist-tag; the version bump is
# committed back to master.
# - Pre-release tag (e.g. v1.2.3-beta.1) -> published to a matching dist-tag
# ("beta", "rc", ...); does NOT
# become "latest" and is NOT
# committed back to master.
#
# Authentication uses npm Trusted Publishing (OIDC) - no token or secret is
# needed. Configure a trusted publisher for this package on npmjs.com:
# Repository: Skylar-Tech/node-red-contrib-matrix-chat
# Workflow: publish.yml
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write # commit the version bump back to master
id-token: write # npm Trusted Publishing (OIDC) + provenance
steps:
- name: Check out the released commit
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
- name: Update npm
# Trusted Publishing requires npm 11.5.1 or newer; Node 22 ships npm 10.
run: npm install -g npm@latest
- name: Determine version and dist-tag
id: ver
run: |
VERSION="${GITHUB_REF_NAME#v}"
if [[ "$VERSION" == *-* ]]; then
# pre-release, e.g. 1.0.0-beta.1 -> dist-tag "beta"
DIST_TAG="${VERSION#*-}"
DIST_TAG="${DIST_TAG%%.*}"
PRERELEASE=true
else
DIST_TAG=latest
PRERELEASE=false
fi
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "dist_tag=$DIST_TAG" >> "$GITHUB_OUTPUT"
echo "prerelease=$PRERELEASE" >> "$GITHUB_OUTPUT"
echo "Publishing $VERSION to npm dist-tag '$DIST_TAG' (prerelease=$PRERELEASE)"
- name: Set version
run: npm version "${{ steps.ver.outputs.version }}" --no-git-tag-version --allow-same-version
- name: Publish to npm
run: npm publish --provenance --access public --tag "${{ steps.ver.outputs.dist_tag }}"
- name: Commit version bump back to master
if: steps.ver.outputs.prerelease == 'false'
run: |
if git diff --quiet; then
echo "package.json already at ${{ steps.ver.outputs.version }}; nothing to commit."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -am "Set version to ${{ steps.ver.outputs.version }}"
git push origin HEAD:master \
|| echo "::warning::Could not push the version bump to master (branch protection?). The package was still published."
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-matrix-chat",
"version": "0.9.1",
"version": "0.9.2",
"description": "Matrix chat server client for Node-RED",
"dependencies": {
"abort-controller": "^3.0.0",
+1 -4
View File
@@ -1,11 +1,10 @@
global.Olm = require('olm');
const fs = require("fs-extra");
let RelationType, TimelineWindow, sdk, LocalStorageCryptoStore, RoomEvent, RoomMemberEvent, HttpApiEvent, ClientEvent, MemoryStore;
let RelationType, sdk, LocalStorageCryptoStore, RoomEvent, RoomMemberEvent, HttpApiEvent, ClientEvent, MemoryStore;
(async () => {
const mod = await import("matrix-js-sdk");
RelationType = mod.RelationType;
TimelineWindow = mod.TimelineWindow;
// matrix-js-sdk doesn't export a default the top-level export is the same object:
sdk = mod;
@@ -502,8 +501,6 @@ module.exports = function(RED) {
localTimeoutMs: '30000'
});
new TimelineWindow(); // from our top-level variable, but to keep minimal changes,
// you can just do: (await import("matrix-js-sdk")).TimelineWindow();
matrixClient.timelineSupport = true;