mirror of
https://github.com/laurent22/joplin.git
synced 2025-03-29 21:21:15 +02:00
Tools: Fixed Docker image tagging for pre-releases
This commit is contained in:
parent
372495afd3
commit
d8752ab889
@ -1,9 +1,10 @@
|
|||||||
import { execCommand2, rootDir } from './tool-utils';
|
import { execCommand2, rootDir } from './tool-utils';
|
||||||
|
|
||||||
function getVersionFromTag(tagName: string): string {
|
function getVersionFromTag(tagName: string, isPreRelease: boolean): string {
|
||||||
if (tagName.indexOf('server-') !== 0) throw new Error(`Invalid tag: ${tagName}`);
|
if (tagName.indexOf('server-') !== 0) throw new Error(`Invalid tag: ${tagName}`);
|
||||||
const s = tagName.split('-');
|
const s = tagName.split('-');
|
||||||
return s[1].substr(1);
|
const suffix = isPreRelease ? '-beta' : '';
|
||||||
|
return s[1].substr(1) + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIsPreRelease(tagName: string): boolean {
|
function getIsPreRelease(tagName: string): boolean {
|
||||||
@ -15,8 +16,8 @@ async function main() {
|
|||||||
if (!argv.tagName) throw new Error('--tag-name not provided');
|
if (!argv.tagName) throw new Error('--tag-name not provided');
|
||||||
|
|
||||||
const tagName = argv.tagName;
|
const tagName = argv.tagName;
|
||||||
const imageVersion = getVersionFromTag(tagName);
|
|
||||||
const isPreRelease = getIsPreRelease(tagName);
|
const isPreRelease = getIsPreRelease(tagName);
|
||||||
|
const imageVersion = getVersionFromTag(tagName, isPreRelease);
|
||||||
|
|
||||||
process.chdir(rootDir);
|
process.chdir(rootDir);
|
||||||
console.info(`Running from: ${process.cwd()}`);
|
console.info(`Running from: ${process.cwd()}`);
|
||||||
@ -26,10 +27,12 @@ async function main() {
|
|||||||
console.info('isPreRelease:', isPreRelease);
|
console.info('isPreRelease:', isPreRelease);
|
||||||
|
|
||||||
await execCommand2(`docker build -t "joplin/server:${imageVersion}" -f Dockerfile.server .`);
|
await execCommand2(`docker build -t "joplin/server:${imageVersion}" -f Dockerfile.server .`);
|
||||||
await execCommand2(`docker tag "joplin/server:${imageVersion}" "joplin/server:latest"`);
|
|
||||||
await execCommand2(`docker push joplin/server:${imageVersion}`);
|
await execCommand2(`docker push joplin/server:${imageVersion}`);
|
||||||
|
|
||||||
if (!isPreRelease) await execCommand2('docker push joplin/server:latest');
|
if (!isPreRelease) {
|
||||||
|
await execCommand2(`docker tag "joplin/server:${imageVersion}" "joplin/server:latest"`);
|
||||||
|
await execCommand2('docker push joplin/server:latest');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch((error) => {
|
main().catch((error) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user