Verified Commit 1d02b000 authored by Luc Everse's avatar Luc Everse
Browse files

Add version information and improve CI usage

parent cf4f6142
Pipeline #1754 passed with stage
in 5 minutes and 54 seconds
......@@ -8,10 +8,23 @@ stages:
- publish
publish:
except:
- tags
stage: publish
script:
- echo "version = '$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA';" >> version.js
- docker info
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY/$CI_PROJECT_PATH .
- docker push $CI_REGISTRY/$CI_PROJECT_PATH
- docker build -t $CI_REGISTRY/$CI_PROJECT_PATH:$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA .
- docker push $CI_REGISTRY/$CI_PROJECT_PATH:$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA
release:
only:
- tags
stage: publish
script:
- echo "version = '$CI_COMMIT_TAG';" >> version.js
- docker info
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY/$CI_PROJECT_PATH:$CI_COMMIT_TAG .
- docker push $CI_REGISTRY/$CI_PROJECT_PATH:$CI_COMMIT_TAG
import axios from 'axios';
import { allOk } from '../assert.js';
import Command from './Command.js';
import getVersion from '../version.js';
export default class VersionCommand extends Command {
constructor(config, logger, messageSender) {
super(config, logger);
allOk(arguments);
this.messageSender = messageSender;
this.regex = /^versie$/i;
}
async action(msg, match, guild) {
const version = getVersion();
if (!version) {
return this.messageSender.reply(msg, "Versieinformatie is niet beschikbaar");
}
let changelog = '';
try {
const wikiPage = encodeURIComponent('nl/logboek/' + version);
const res = await axios.get(
'https://git.wukl.net/api/v4/projects/74/wikis/' + wikiPage
)
changelog = res.data.content;
} catch (ex) {
this.logger.log('Unable to download changelog');
this.logger.log(ex);
}
return this.messageSender.reply(msg, version + (changelog ? '\n' + changelog : ''));
}
}
......@@ -32,6 +32,7 @@ import BlacklistCommand from './command/BlacklistCommand.js';
import UnBlacklistCommand from './command/UnBlacklistCommand.js';
import ToggleRadioModeCommand from './command/ToggleRadioModeCommand.js';
import ThankCommand from './command/ThankCommand.js';
import VersionCommand from './command/VersionCommand.js';
let config = loadConfig();
......@@ -77,6 +78,7 @@ client.on('ready', () => {
new UnBlacklistCommand(config, logger, client, messageSender),
new HistoryCommand(config, logger, songListSender),
new ThankCommand(config, logger, messageSender),
new VersionCommand(config, logger, messageSender),
];
commands.push(new HelpCommand(config, logger, messageSender, commands));
......
......@@ -9,6 +9,7 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"axios": "^0.21.1",
"bubble-scatter": "^1.0.0",
"csv-stringify": "^5.5.3",
"date-fns": "^2.19.0",
......@@ -55,6 +56,14 @@
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"node_modules/axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"dependencies": {
"follow-redirects": "^1.10.0"
}
},
"node_modules/bindings": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz",
......@@ -154,6 +163,25 @@
"resolved": "https://registry.npmjs.org/fn-mt/-/fn-mt-1.2.1.tgz",
"integrity": "sha512-pH4wCsSEfuaffWysGvOds36E9qVAoUK9Up9dWqNTx/qLTQobdOxriINVxd1xoQjMNn+ozMifc425mvgOgK21pQ=="
},
"node_modules/follow-redirects": {
"version": "1.13.3",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.3.tgz",
"integrity": "sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/m3u8stream": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/m3u8stream/-/m3u8stream-0.8.3.tgz",
......@@ -396,6 +424,14 @@
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"requires": {
"follow-redirects": "^1.10.0"
}
},
"bindings": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz",
......@@ -476,6 +512,11 @@
"resolved": "https://registry.npmjs.org/fn-mt/-/fn-mt-1.2.1.tgz",
"integrity": "sha512-pH4wCsSEfuaffWysGvOds36E9qVAoUK9Up9dWqNTx/qLTQobdOxriINVxd1xoQjMNn+ozMifc425mvgOgK21pQ=="
},
"follow-redirects": {
"version": "1.13.3",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.3.tgz",
"integrity": "sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA=="
},
"m3u8stream": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/m3u8stream/-/m3u8stream-0.8.3.tgz",
......
......@@ -11,6 +11,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^0.21.1",
"bubble-scatter": "^1.0.0",
"csv-stringify": "^5.5.3",
"date-fns": "^2.19.0",
......
let version;
export default function getVersion() { return version; };
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment