Skip to content
Snippets Groups Projects
Commit ef2242b9 authored by Konstantin Schulz's avatar Konstantin Schulz
Browse files

fix version display

parent 013d26e7
No related branches found
No related tags found
No related merge requests found
Pipeline #51169 failed
stages: stages:
- tag_version
- build - build
- ci - ci
- coverage - coverage
...@@ -11,14 +10,6 @@ workflow: ...@@ -11,14 +10,6 @@ workflow:
- if: '$CI_COMMIT_TAG' - if: '$CI_COMMIT_TAG'
when: never when: never
- when: always - when: always
#TODO: add version tagging as separate Docker service, trigger it before frontend source compilation
tag_version:
image: python:3.8-alpine
stage: tag_version
script:
- apk update
- apk add --no-cache git
- python3 ./mc_frontend/update_version.py
build: build:
image: docker:24.0.5 image: docker:24.0.5
services: services:
......
...@@ -14,7 +14,7 @@ services: ...@@ -14,7 +14,7 @@ services:
build: build:
context: ./mc_frontend context: ./mc_frontend
dockerfile: Dockerfile dockerfile: Dockerfile
entrypoint: ng build --prod app entrypoint: npm run build-prod
image: konstantinschulz/mc_frontend:latest image: konstantinschulz/mc_frontend:latest
volumes: volumes:
- ./mc_frontend/www:/home/mc/mc_frontend/www - ./mc_frontend/www:/home/mc/mc_frontend/www
...@@ -33,8 +33,6 @@ services: ...@@ -33,8 +33,6 @@ services:
ports: ports:
- "5000:5000" - "5000:5000"
restart: always restart: always
volumes:
- ./mc_frontend/src/version.ts:/home/mc/version.ts
nginx: nginx:
command: nginx -g "daemon off;" command: nginx -g "daemon off;"
image: nginx:alpine image: nginx:alpine
......
This diff is collapsed.
{ {
"name": "mc_frontend", "name": "mc_frontend",
"version": "1.8.4", "version": "2.7.7",
"author": "Ionic Framework", "author": "Ionic Framework",
"homepage": "https://ionicframework.com/", "homepage": "https://ionicframework.com/",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "python update_version.py && ng serve --port 8100", "start": "npm run tag && ng serve --port 8100",
"build": "ng build", "build": "ng build",
"build-prod": "npm run tag && ng build --prod app",
"test-ci": "ng test --code-coverage --watch=false", "test-ci": "ng test --code-coverage --watch=false",
"test-cov": "ng test --code-coverage --watch=true", "test-cov": "ng test --code-coverage --watch=true",
"test-debug": "ng test --watch=true --browsers=Chrome", "test-debug": "ng test --watch=true --browsers=Chrome",
"lint": "ng lint", "lint": "ng lint",
"e2e": "ng e2e" "e2e": "ng e2e",
"tag": "node -p \"'export const VERSION = ' + JSON.stringify(require('./package.json').version) + ';'\" > src/version.ts"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
......
...@@ -7,8 +7,8 @@ import {TranslateService} from '@ngx-translate/core'; ...@@ -7,8 +7,8 @@ import {TranslateService} from '@ngx-translate/core';
import {ExerciseService} from 'src/app/exercise.service'; import {ExerciseService} from 'src/app/exercise.service';
import {CorpusService} from 'src/app/corpus.service'; import {CorpusService} from 'src/app/corpus.service';
import {take} from 'rxjs/operators'; import {take} from 'rxjs/operators';
import {version} from 'src/version';
import configMC from '../../configMC'; import configMC from '../../configMC';
import {VERSION} from "../../version";
@Component({ @Component({
selector: 'app-home', selector: 'app-home',
...@@ -60,7 +60,7 @@ export class HomePage implements OnInit { ...@@ -60,7 +60,7 @@ export class HomePage implements OnInit {
tabs.style.maxWidth = '65%'; tabs.style.maxWidth = '65%';
} }
} }
this.version = version; this.version = VERSION;
} }
refreshCorpora(): Promise<void> { refreshCorpora(): Promise<void> {
......
try:
import os
import subprocess
current_path = os.path.realpath(__file__)
version_file_path = os.path.join(os.path.dirname(current_path), "src", "version.ts")
version_log_file_path = os.path.abspath("version.log")
tag_bytes = ""
if os.path.exists(version_log_file_path):
with open(version_log_file_path) as f:
tag_bytes = f.read()
else:
tag_bytes = subprocess.check_output("git tag --points-at HEAD", shell=True)[:-1].decode('utf-8')
with open(version_file_path, "w+") as f:
f.write("export const version = '{0}';\n".format(tag_bytes))
except:
pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment