diff --git a/.circleci/config.yml b/.circleci/config.yml index 1df9f38..a199e68 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,11 @@ jobs: working_directory: ~/app steps: - checkout + - run: + name: Get current git commit message + command: | + echo "export COMMIT_MESSAGE=\"$(git log --format=oneline -n 1 $CIRCLE_SHA1)\"" >> $BASH_ENV + source $BASH_ENV - run: name: Install npm deployment app command: sudo npm install -g github-release-cli @@ -19,7 +24,7 @@ jobs: command: | PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[", ]//g') echo "Packaging to ${CIRCLE_PROJECT_REPONAME}_build-sc.zip" - zip "${CIRCLE_PROJECT_REPONAME}_build-sc.zip" index.mjs package.json public api/** + zip "${CIRCLE_PROJECT_REPONAME}_build-sc.zip" index.mjs package.json api/**/* echo "Creating release '${PACKAGE_VERSION}.${CIRCLE_BUILD_NUM}'" github-release upload \ --commitish $CIRCLE_SHA1 \ @@ -28,7 +33,7 @@ jobs: --repo $CIRCLE_PROJECT_REPONAME \ --tag "v${PACKAGE_VERSION}.${CIRCLE_BUILD_NUM}" \ --name "v${PACKAGE_VERSION}.${CIRCLE_BUILD_NUM}" \ - --body "Automatic CircleCI Build of v${PACKAGE_VERSION}.${CIRCLE_BUILD_NUM} from ${CIRCLE_SHA1}" \ + --body "Automatic CircleCI Build of v${PACKAGE_VERSION}.${CIRCLE_BUILD_NUM} from ${CIRCLE_SHA1}: ${COMMIT_MESSAGE}" \ "${CIRCLE_PROJECT_REPONAME}_build-sc.zip" workflows: diff --git a/api/core/coremonitor.mjs b/api/core/coremonitor.mjs index 86f5c88..1c6a2f5 100644 --- a/api/core/coremonitor.mjs +++ b/api/core/coremonitor.mjs @@ -17,4 +17,10 @@ export default function coremonitor(io, config, db, log, core) { logs: app.logs, }) })) + core.on('managelog', safeWrap(log, 'coremonitor.on.managelog', function(manage) { + io.to('core.manage').emit('core.program.log', { + name: 'manage', + logs: manage.logs, + }) + })) } \ No newline at end of file diff --git a/api/core/ioroutes.mjs b/api/core/ioroutes.mjs index 96f8764..9781537 100644 --- a/api/core/ioroutes.mjs +++ b/api/core/ioroutes.mjs @@ -120,6 +120,19 @@ export async function listentoapp(ctx) { }) } +/* + * Event: 'core.listentomanage' + * + * Start listening to changes in core manage + */ +export async function listentomanage(ctx) { + ctx.socket.join('core.manage') + ctx.socket.emit('core.program.log', { + name: 'manage', + logs: ctx.core.getProgramLogs('manage') + }) +} + /* * Event: 'core.unlistentoapp' * @@ -128,3 +141,12 @@ export async function listentoapp(ctx) { export async function unlistentoapp(ctx) { ctx.socket.leave('core.app') } + +/* + * Event: 'core.unlistentomanage' + * + * Stop listening to new log lines + */ +export async function unlistentomanage(ctx) { + ctx.socket.leave('core.manage') +} diff --git a/client/updater/updater.js b/client/updater/updater.js index 87f49c6..1c563ed 100644 --- a/client/updater/updater.js +++ b/client/updater/updater.js @@ -80,7 +80,11 @@ const Updater = Module({ loadAppData() { this.updateActiveDb() if (this.activeApp === 'app') { + socket.emit('core.unlistentomanage', {}) socket.emit('core.listentoapp', {}) + } else { + socket.emit('core.unlistentoapp', {}) + socket.emit('core.listentomanage', {}) } /* request to listen to app updates */ }, @@ -88,6 +92,7 @@ const Updater = Module({ remove: function() { socket.emit('core.unlistencore', {}) socket.emit('core.unlistentoapp', {}) + socket.emit('core.unlistentomanage', {}) }, startUpdate: function() { @@ -113,7 +118,7 @@ const Updater = Module({ href: '/updater/app', }, 'Update App'), m(m.route.Link, { - hidden: this.manageRepository, + hidden: !this.manageRepository, class: 'button' + (this.activeApp === 'manage' ? ' active' : ''), href: '/updater/manage', }, 'Update Manager'), diff --git a/config.json b/config.json index 6c56ee4..72d3aa8 100644 --- a/config.json +++ b/config.json @@ -6,5 +6,5 @@ "managePort": 4271, "devPort": 4269, "appRepository": "thething/sc-helloworld", - "manageRepository": null + "manageRepository": "TheThing/sc-manager" }