From 45b39be6b358d8cc5ea572bfe1dfa637c6a3cd65 Mon Sep 17 00:00:00 2001
From: Lansana DIOMANDE <ldiomande@takima.fr>
Date: Mon, 16 May 2022 12:10:38 +0200
Subject: [PATCH] fix: improve pipeline

---
 .gitlab-ci.yml                                | 36 +++++++++++++++----
 .../deadlock-extension/CHANGELOG.md           | 16 +++++++++
 .../deadlock-extension/package-lock.json      |  4 +--
 .../deadlock-extension/package.json           |  4 +--
 .../src/core/callApi.service.ts               |  6 ++--
 .../deadlock-extension/src/core/controller.ts |  4 +--
 .../deadlock-extension/src/core/mission.ts    |  4 +--
 .../deadlock-extension/src/core/userConfig.ts |  2 +-
 8 files changed, 57 insertions(+), 19 deletions(-)
 create mode 100644 deadlock-plugins/deadlock-extension/CHANGELOG.md

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ec8a9c7b..8286afb5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,13 +6,6 @@ stages:
   - build
   - publish
 
-before_script:
-  - apk update
-  - apk add nodejs npm
-  - apk add yarn
-  - apk add curl
-  - export TAG=${CI_COMMIT_TAG:-latest}
-  - ./setup.sh
 
 build:
   stage: build
@@ -20,6 +13,12 @@ build:
     - docker:18.09.6-dind
   variables:
     VERSION: "desktop"
+
+  before_script:
+    - apk update
+    - apk add nodejs npm
+    - export TAG=${CI_COMMIT_TAG:-latest}
+    - ./setup.sh
   script:
     - ./build.sh $TAG desktop $CI_REGISTRY_IMAGE
     - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $REGISTRY
@@ -34,9 +33,15 @@ desktop_extension:package:pre-release:
     paths:
       - $EXTENSION_PATH
     policy: push
+  before_script:
+    - apk update
+    - apk add nodejs npm
+    - rm -f $EXTENSION_PATH/*.vsix
+    - npm install --prefix $EXTENSION_PATH
   script:
     - ./build-desktop.sh staging
   rules:
+    - if: $CI_COMMIT_BRANCH == "develop"
     - if: $CI_COMMIT_TAG =~ /(?:\d+.){2}(?:\d+)*(1|3|5|7|9)$/ # If tag is like X.Y.Z and Z is odd
 
 
@@ -46,10 +51,16 @@ desktop_extension:publish:pre-release:
     paths:
       - $EXTENSION_PATH
     policy: pull
+
+  before_script:
+    - apk update
+    - apk add nodejs npm
+    - npm install --prefix $EXTENSION_PATH
   script:
     - cd $EXTENSION_PATH
     - npm run vsce-publish -- --pre-release -p $VSCODE_EXTENSION_MARKET_PLACE_ACCESS_TOKEN
   rules:
+    - if: $CI_COMMIT_BRANCH == "develop"
     - if: $CI_COMMIT_TAG =~ /(?:\d+.){2}(?:\d+)*(1|3|5|7|9)$/ # If tag is like X.Y.Z and Z is odd
 
 
@@ -58,7 +69,13 @@ desktop_extension:package:release:
   cache:
     paths:
       - $EXTENSION_PATH
+
     policy: push
+  before_script:
+    - apk update
+    - apk add nodejs npm
+    - rm -f $EXTENSION_PATH/*.vsix
+    - npm install --prefix $EXTENSION_PATH
   script:
     - ./build-desktop.sh prod
   rules:
@@ -70,6 +87,11 @@ desktop_extension:publish:release:
     paths:
       - $EXTENSION_PATH
     policy: pull
+
+  before_script:
+    - apk update
+    - apk add nodejs npm
+    - npm install --prefix $EXTENSION_PATH
   script:
     - cd $EXTENSION_PATH
     - npm run vsce-publish -- -p $VSCODE_EXTENSION_MARKET_PLACE_ACCESS_TOKEN
diff --git a/deadlock-plugins/deadlock-extension/CHANGELOG.md b/deadlock-plugins/deadlock-extension/CHANGELOG.md
new file mode 100644
index 00000000..aebcbe03
--- /dev/null
+++ b/deadlock-plugins/deadlock-extension/CHANGELOG.md
@@ -0,0 +1,16 @@
+### Changelog
+
+All notable changes to this project will be documented in this file. Dates are displayed in UTC.
+
+Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
+
+#### 0.1.5
+
+- feat: publish_extension_on_marketplace_with_ci [`#5`](https://gitlab.takima.io/deadlock-public/deadlock-desktop/merge_requests/5)
+- fix(view): open `Help` panel by default + fix split screen on views opening after several restarts [`#2`](https://gitlab.takima.io/deadlock-public/deadlock-desktop/merge_requests/2)
+- Feat theia professor [`#4`](https://gitlab.takima.io/deadlock-public/deadlock-desktop/merge_requests/4)
+- Pull on start [`#3`](https://gitlab.takima.io/deadlock-public/deadlock-desktop/merge_requests/3)
+- feat: git pull on startup, refactor user-challenge config [`#2`](https://gitlab.takima.io/deadlock-public/deadlock-desktop/merge_requests/2)
+- feat: use new theia build [`43dee03`](https://gitlab.takima.io/deadlock-public/deadlock-desktop/commit/43dee036539001951de56197cf96bc36a46945b7)
+- chores: clean theia resources [`8a8ab05`](https://gitlab.takima.io/deadlock-public/deadlock-desktop/commit/8a8ab05c2a6b723d587dc455fcbe2ae03d608de9)
+- refactor: apply some recommendation [`cc647f5`](https://gitlab.takima.io/deadlock-public/deadlock-desktop/commit/cc647f51cfa9325db11c0450cf8f37ba681c83ca)
diff --git a/deadlock-plugins/deadlock-extension/package-lock.json b/deadlock-plugins/deadlock-extension/package-lock.json
index 3c270bbc..a3ea78bd 100644
--- a/deadlock-plugins/deadlock-extension/package-lock.json
+++ b/deadlock-plugins/deadlock-extension/package-lock.json
@@ -1,12 +1,12 @@
 {
   "name": "deadlock-coding",
-  "version": "0.1.3",
+  "version": "0.1.5",
   "lockfileVersion": 2,
   "requires": true,
   "packages": {
     "": {
       "name": "deadlock-coding",
-      "version": "0.1.3",
+      "version": "0.1.5",
       "dependencies": {
         "@vscode/webview-ui-toolkit": "^1.0.0",
         "async": "^3.2.2",
diff --git a/deadlock-plugins/deadlock-extension/package.json b/deadlock-plugins/deadlock-extension/package.json
index 21e77f21..9fb9534f 100644
--- a/deadlock-plugins/deadlock-extension/package.json
+++ b/deadlock-plugins/deadlock-extension/package.json
@@ -1,7 +1,7 @@
 {
   "name": "deadlock-coding",
   "description": "Deadlock Coding",
-  "version": "0.1.4",
+  "version": "0.1.5",
   "publisher": "Deadlock",
   "icon": "media/logo.png",
   "engines": {
@@ -17,7 +17,7 @@
     "onWebviewPanel:deadlockHelp",
     "onStartupFinished"
   ],
-  "main": "./out/main.js",
+  "main": "out/main.js",
   "contributes": {
     "commands": [
       {
diff --git a/deadlock-plugins/deadlock-extension/src/core/callApi.service.ts b/deadlock-plugins/deadlock-extension/src/core/callApi.service.ts
index cdd72e12..da086311 100644
--- a/deadlock-plugins/deadlock-extension/src/core/callApi.service.ts
+++ b/deadlock-plugins/deadlock-extension/src/core/callApi.service.ts
@@ -1,8 +1,8 @@
-import { GiteaPublicProperties } from './../customTypings/giteaPublicProperties.model';
-import { SshKeyPair } from './../customTypings/sshKeyPair.model';
 import axios, { AxiosInstance } from 'axios';
 import { API_QUERY_REFERER, API_URL } from '../config';
-import { User } from '../customTypings/user.model';
+import { GiteaPublicProperties } from '../model/giteaPublicProperties.model';
+import { SshKeyPair } from '../model/sshKeyPair.model';
+import { User } from '../model/user.model';
 import Controller from './controller';
 import ExtensionStore from './extensionStore';
 import KeycloakOAuth2DeviceFlowConnection from './keycloakOAuth2DeviceFlowConnection';
diff --git a/deadlock-plugins/deadlock-extension/src/core/controller.ts b/deadlock-plugins/deadlock-extension/src/core/controller.ts
index c3f8e519..ced2bd6b 100644
--- a/deadlock-plugins/deadlock-extension/src/core/controller.ts
+++ b/deadlock-plugins/deadlock-extension/src/core/controller.ts
@@ -1,5 +1,3 @@
-import { GiteaPublicProperties } from './../customTypings/giteaPublicProperties.model';
-import { User } from './../customTypings/user.model';
 import * as vscode from 'vscode';
 import {
   KEYCLOAK_DEVICE_AUTH_URL,
@@ -19,6 +17,8 @@ import Mission from './mission';
 import CallApiService from './callApi.service';
 import KeycloakOAuth2DeviceFlowConnectionVSCodeImpl from './keycloakOAuth2DeviceFlowConnectionVSCodeImpl';
 import SshKeyManager from './sshKeyManager';
+import { GiteaPublicProperties } from '../model/giteaPublicProperties.model';
+import { User } from '../model/user.model';
 
 export default class Controller {
   public connection: KeycloakOAuth2DeviceFlowConnection;
diff --git a/deadlock-plugins/deadlock-extension/src/core/mission.ts b/deadlock-plugins/deadlock-extension/src/core/mission.ts
index c44f68d2..b3875cf7 100644
--- a/deadlock-plugins/deadlock-extension/src/core/mission.ts
+++ b/deadlock-plugins/deadlock-extension/src/core/mission.ts
@@ -1,12 +1,12 @@
-import { GiteaPublicProperties } from './../customTypings/giteaPublicProperties.model';
 import { exec as _exec } from 'child_process';
 import * as fs from 'fs';
 import * as util from 'util';
 import * as vscode from 'vscode';
 import { error as err, log } from '../recorder/utils';
 import ExtensionStore from './extensionStore';
-import { User, UserChallengeJson } from '../customTypings/user.model';
 import { userSshKeyFolderPath } from './config';
+import { GiteaPublicProperties } from '../model/giteaPublicProperties.model';
+import { User, UserChallengeJson } from '../model/user.model';
 
 /**
  * {@link https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback}
diff --git a/deadlock-plugins/deadlock-extension/src/core/userConfig.ts b/deadlock-plugins/deadlock-extension/src/core/userConfig.ts
index 80d0317d..d881fb96 100644
--- a/deadlock-plugins/deadlock-extension/src/core/userConfig.ts
+++ b/deadlock-plugins/deadlock-extension/src/core/userConfig.ts
@@ -14,8 +14,8 @@
  * "missionId":"code_persist_cdb_crud"
  * }
  */
+import { UserDetails } from '../model/user.model';
 import { error } from '../recorder/utils';
-import { UserDetails } from '../customTypings/user.model';
 
 export default abstract class UserConfig {
   private userConfigJson: any | undefined;
-- 
GitLab