Merge pull request 'add git info to build' (#8) from build-git-info into develop
Some checks are pending
Publish Docker image / Build (push) Waiting to run
Lint / pnpm_install (push) Waiting to run
Lint / lint (backend) (push) Blocked by required conditions
Lint / lint (frontend) (push) Blocked by required conditions
Lint / lint (frontend-embed) (push) Blocked by required conditions
Lint / lint (frontend-shared) (push) Blocked by required conditions
Lint / lint (misskey-bubble-game) (push) Blocked by required conditions
Lint / lint (misskey-js) (push) Blocked by required conditions
Lint / lint (misskey-reversi) (push) Blocked by required conditions
Lint / lint (sw) (push) Blocked by required conditions
Lint / typecheck (backend) (push) Blocked by required conditions
Lint / typecheck (misskey-js) (push) Blocked by required conditions
Lint / typecheck (sw) (push) Blocked by required conditions
Test (production install and build) / production (20.16.0) (push) Waiting to run
Test (backend) / unit (20.16.0) (push) Successful in 7m48s
Test (backend) / e2e (20.16.0) (push) Successful in 12m31s
Some checks are pending
Publish Docker image / Build (push) Waiting to run
Lint / pnpm_install (push) Waiting to run
Lint / lint (backend) (push) Blocked by required conditions
Lint / lint (frontend) (push) Blocked by required conditions
Lint / lint (frontend-embed) (push) Blocked by required conditions
Lint / lint (frontend-shared) (push) Blocked by required conditions
Lint / lint (misskey-bubble-game) (push) Blocked by required conditions
Lint / lint (misskey-js) (push) Blocked by required conditions
Lint / lint (misskey-reversi) (push) Blocked by required conditions
Lint / lint (sw) (push) Blocked by required conditions
Lint / typecheck (backend) (push) Blocked by required conditions
Lint / typecheck (misskey-js) (push) Blocked by required conditions
Lint / typecheck (sw) (push) Blocked by required conditions
Test (production install and build) / production (20.16.0) (push) Waiting to run
Test (backend) / unit (20.16.0) (push) Successful in 7m48s
Test (backend) / e2e (20.16.0) (push) Successful in 12m31s
Reviewed-on: #8
This commit is contained in:
commit
48b935e88c
3 changed files with 17 additions and 2 deletions
|
@ -155,6 +155,8 @@ export type Config = {
|
||||||
signToActivityPubGet: boolean | undefined;
|
signToActivityPubGet: boolean | undefined;
|
||||||
|
|
||||||
version: string;
|
version: string;
|
||||||
|
gitDescribe: string;
|
||||||
|
gitCommit: string;
|
||||||
publishTarballInsteadOfProvideRepositoryUrl: boolean;
|
publishTarballInsteadOfProvideRepositoryUrl: boolean;
|
||||||
setupPassword: string | undefined;
|
setupPassword: string | undefined;
|
||||||
host: string;
|
host: string;
|
||||||
|
@ -218,7 +220,7 @@ export function loadConfig(): Config {
|
||||||
const config = yaml.load(fs.readFileSync(path, 'utf-8')) as Source;
|
const config = yaml.load(fs.readFileSync(path, 'utf-8')) as Source;
|
||||||
|
|
||||||
const url = tryCreateUrl(config.url ?? process.env.MISSKEY_URL ?? '');
|
const url = tryCreateUrl(config.url ?? process.env.MISSKEY_URL ?? '');
|
||||||
const version = meta.version;
|
const { version, gitDescribe, gitCommit } = meta;
|
||||||
const host = url.host;
|
const host = url.host;
|
||||||
const hostname = url.hostname;
|
const hostname = url.hostname;
|
||||||
const scheme = url.protocol.replace(/:$/, '');
|
const scheme = url.protocol.replace(/:$/, '');
|
||||||
|
@ -236,6 +238,8 @@ export function loadConfig(): Config {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
version,
|
version,
|
||||||
|
gitCommit,
|
||||||
|
gitDescribe,
|
||||||
publishTarballInsteadOfProvideRepositoryUrl: !!config.publishTarballInsteadOfProvideRepositoryUrl,
|
publishTarballInsteadOfProvideRepositoryUrl: !!config.publishTarballInsteadOfProvideRepositoryUrl,
|
||||||
setupPassword: config.setupPassword,
|
setupPassword: config.setupPassword,
|
||||||
url: url.origin,
|
url: url.origin,
|
||||||
|
|
|
@ -105,6 +105,8 @@ export class NodeinfoServerService {
|
||||||
name: meta.maintainerName,
|
name: meta.maintainerName,
|
||||||
email: meta.maintainerEmail,
|
email: meta.maintainerEmail,
|
||||||
},
|
},
|
||||||
|
gitCommit: this.config.gitCommit,
|
||||||
|
gitDescribe: this.config.gitDescribe,
|
||||||
langs: meta.langs,
|
langs: meta.langs,
|
||||||
tosUrl: meta.termsOfServiceUrl,
|
tosUrl: meta.termsOfServiceUrl,
|
||||||
privacyPolicyUrl: meta.privacyPolicyUrl,
|
privacyPolicyUrl: meta.privacyPolicyUrl,
|
||||||
|
|
|
@ -4,14 +4,23 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const child_process = require('child_process');
|
||||||
const packageJsonPath = __dirname + '/../package.json'
|
const packageJsonPath = __dirname + '/../package.json'
|
||||||
|
|
||||||
function build() {
|
function build() {
|
||||||
try {
|
try {
|
||||||
|
const gitDescribe = child_process.execSync('git describe --tags --always').toString().trim();
|
||||||
|
const gitCommit = child_process.execSync('git rev-parse HEAD').toString().trim();
|
||||||
const json = fs.readFileSync(packageJsonPath, 'utf-8')
|
const json = fs.readFileSync(packageJsonPath, 'utf-8')
|
||||||
const meta = JSON.parse(json);
|
const meta = JSON.parse(json);
|
||||||
fs.mkdirSync(__dirname + '/../built', { recursive: true });
|
fs.mkdirSync(__dirname + '/../built', { recursive: true });
|
||||||
fs.writeFileSync(__dirname + '/../built/meta.json', JSON.stringify({ version: meta.version }), 'utf-8');
|
fs.writeFileSync(__dirname + '/../built/meta.json',
|
||||||
|
JSON.stringify(
|
||||||
|
{
|
||||||
|
version: meta.version,
|
||||||
|
gitCommit: gitCommit,
|
||||||
|
gitDescribe: gitDescribe,
|
||||||
|
}), 'utf-8');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue