@vaharoni/devops 1.1.4 → 1.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,12 +29,12 @@ Currently, the repo works with `bun` as the package manager for node and `uv` fo
29
29
  Run this in your local copy of the devops folder:
30
30
  ```shell
31
31
  bun link
32
+ bun run build
32
33
  ```
33
34
 
34
35
  Run this in a local package using the project for testing:
35
36
  ```shell
36
37
  bun link @vaharoni/devops
37
- bun run build
38
38
  ```
39
39
 
40
40
  When done:
@@ -70,6 +70,7 @@ export declare class CommandExecutor {
70
70
  _prepareFullCommand(): string;
71
71
  _getProcessEnv(envOverride?: {}): {
72
72
  MONOREPO_ENV: string | undefined;
73
+ MONOREPO_ROOT: string;
73
74
  TZ?: string;
74
75
  NODE_ENV?: string;
75
76
  };
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/cli/common.ts"],"names":[],"mappings":"AAMA,KAAK,UAAU,GAAG;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC7C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAQF,qBAAa,gBAAgB;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,OAAO,CAAC;gBAEV,QAAQ,EAAE,MAAM,EAAE;IAsB9B,eAAe,CACb,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,IAAI,CAAC,sBAAsB,EAAE,KAAK,CAAM,GAChD,eAAe;IAiBlB,YAAY,CAAC,EACX,MAAW,EACX,Q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,CAAC,OAAO,CAAC,EAAE;QACb,cAAc,CAAC,EAAE,KAAK,CAAC;QACvB,QAAQ,CAAC,EAAE,KAAK,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,GAAG,MAAM;IACV,IAAI,CAAC,OAAO,EAAE;QAAE,cAAc,CAAC,EAAE,KAAK,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG;QACvE,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB;IACD,IAAI,CAAC,OAAO,EAAE;QACZ,cAAc,EAAE,IAAI,CAAC;QACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,GAAG,MAAM;IA6BV,kIAAkI;IAClI,KAAK,CAAC,EAAE,GAAQ,EAAE;;KAAK;IAiCvB,mBAAmB;IAmBnB,cAAc,CAAC,WAAW,KAAK;;;;;;IAI/B,kBAAkB;IASlB,kBAAkB;CASnB;AAED,wBAAgB,iBAAiB,CAAC,GAAG,CAAC,EAAE,MAAM,YAS7C;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAGrD;AAED,qBAAa,YAAY;IACX,OAAO,CAAC,KAAK;IAAU,OAAO,CAAC,IAAI;gBAA3B,KAAK,EAAE,MAAM,EAAU,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnF,QAAQ,CAAC,GAAG,EAAE,MAAM;IAQpB,QAAQ,CAAC,GAAG,EAAE,MAAM;CAGrB"}
@@ -172,7 +172,7 @@ export class CommandExecutor {
172
172
  _prepareFullCommand() {
173
173
  const envPrefix = this.env ? this._envInjectorPrefix() : "";
174
174
  const fullCommand = [envPrefix, this.commandStr].join(" ").trim();
175
- const envPrefixLog = this.env ? `MONOREPO_ENV=${this.env}` : "";
175
+ const envPrefixLog = this.env ? `MONOREPO_ENV=${this.env} MONOREPO_ROOT=${process.cwd()}` : "";
176
176
  const fullCommandLog = [envPrefixLog, fullCommand].join(" ").trim();
177
177
  if (this.redactedCommand) {
178
178
  console.warn(chalk.yellow(fullCommandLog.replace(this.commandStr, this.redactedCommand)));
@@ -183,7 +183,7 @@ export class CommandExecutor {
183
183
  return fullCommand;
184
184
  }
185
185
  _getProcessEnv(envOverride = {}) {
186
- return { ...process.env, MONOREPO_ENV: this.env, ...envOverride };
186
+ return { ...process.env, MONOREPO_ENV: this.env, MONOREPO_ROOT: process.cwd(), ...envOverride };
187
187
  }
188
188
  _envInjectorPrefix() {
189
189
  const envFiles = dotEnvFilesForEnv(this.env);
@@ -8,13 +8,13 @@ export function workspaces() {
8
8
  return _workspaces;
9
9
  const nodeWorkspacesData = nodeWorkspaces();
10
10
  const pythonWorkspacesData = pythonWorkspaces();
11
- Object.values(nodeWorkspacesData).forEach(data => {
11
+ Object.values(nodeWorkspacesData).forEach((data) => {
12
12
  _workspaces[data.name] = {
13
13
  rootPath: data.rootPath,
14
- packageDataEntries: [data]
14
+ packageDataEntries: [data],
15
15
  };
16
16
  });
17
- Object.values(pythonWorkspacesData).forEach(data => {
17
+ Object.values(pythonWorkspacesData).forEach((data) => {
18
18
  const existing = _workspaces[data.name];
19
19
  if (existing) {
20
20
  if (existing.rootPath !== data.rootPath) {
@@ -26,7 +26,7 @@ export function workspaces() {
26
26
  else {
27
27
  _workspaces[data.name] = {
28
28
  rootPath: data.rootPath,
29
- packageDataEntries: []
29
+ packageDataEntries: [],
30
30
  };
31
31
  }
32
32
  _workspaces[data.name].packageDataEntries.push(data);
@@ -1 +1 @@
1
- {"version":3,"file":"process-package-json.d.ts","sourceRoot":"","sources":["../../../src/libs/discovery/process-package-json.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAWtE,wBAAgB,cAAc,gCA+B7B"}
1
+ {"version":3,"file":"process-package-json.d.ts","sourceRoot":"","sources":["../../../src/libs/discovery/process-package-json.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAYtE,wBAAgB,cAAc,gCAqC7B"}
@@ -4,13 +4,14 @@ import { globSync } from "glob";
4
4
  import path from "path";
5
5
  import { packageFileNodeSchema } from "../../types";
6
6
  import { PackageDataProcessor } from "./process-common";
7
- const rootPkgJsonPath = path.join(process.cwd(), "package.json");
7
+ const rootPath = process.env.MONOREPO_ROOT || process.cwd();
8
+ const rootPkgJsonPath = path.join(rootPath, "package.json");
8
9
  const rootPkgJson = JSON.parse(fs.readFileSync(rootPkgJsonPath, "utf8"));
9
10
  const _workspaces = {};
10
11
  let _workspacesLoaded = false;
11
12
  export function nodeWorkspaces() {
12
13
  if (!_workspacesLoaded) {
13
- const allPackageJsons = (rootPkgJson.workspaces ?? []).flatMap((workspaceGlob) => globSync(path.join(workspaceGlob, "package.json")));
14
+ const allPackageJsons = (rootPkgJson.workspaces ?? []).flatMap((workspaceGlob) => globSync(path.join(rootPath, workspaceGlob, "package.json")));
14
15
  const processor = new PackageDataProcessor({
15
16
  language: "node",
16
17
  pathList: allPackageJsons,
@@ -18,11 +19,16 @@ export function nodeWorkspaces() {
18
19
  fileParser: JSON.parse,
19
20
  nameExtractor: (data) => data.name,
20
21
  });
21
- processor.convert((data) => {
22
+ processor
23
+ .convert((data) => {
22
24
  const { dependencies, ...rest } = data;
23
25
  const dependencyNames = Object.keys(dependencies ?? []);
24
- return { ...rest, dependencyNames: processor.filterDependencies(dependencyNames) };
25
- }).forEach(pkgData => {
26
+ return {
27
+ ...rest,
28
+ dependencyNames: processor.filterDependencies(dependencyNames),
29
+ };
30
+ })
31
+ .forEach((pkgData) => {
26
32
  _workspaces[pkgData.name] = pkgData;
27
33
  });
28
34
  console.warn(chalk.yellow(
@@ -1 +1 @@
1
- {"version":3,"file":"process-pyproject-toml.d.ts","sourceRoot":"","sources":["../../../src/libs/discovery/process-pyproject-toml.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAOxE,wBAAgB,gBAAgB,gCAiC/B"}
1
+ {"version":3,"file":"process-pyproject-toml.d.ts","sourceRoot":"","sources":["../../../src/libs/discovery/process-pyproject-toml.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AASxE,wBAAgB,gBAAgB,gCAqC/B"}
@@ -2,12 +2,14 @@ import chalk from "chalk";
2
2
  import { globSync } from "glob";
3
3
  import { packageFilePythonSchema } from "../../types";
4
4
  import { PackageDataProcessor } from "./process-common";
5
- import TOML from '@iarna/toml';
5
+ import TOML from "@iarna/toml";
6
+ import path from "path";
7
+ const rootPath = process.env.MONOREPO_ROOT || process.cwd();
6
8
  const _workspaces = {};
7
9
  let _workspacesLoaded = false;
8
10
  export function pythonWorkspaces() {
9
11
  if (!_workspacesLoaded) {
10
- const allPyprojectTomls = globSync("**/*/pyproject.toml");
12
+ const allPyprojectTomls = globSync(path.join(rootPath, "**/*/pyproject.toml"));
11
13
  const processor = new PackageDataProcessor({
12
14
  language: "python",
13
15
  pathList: allPyprojectTomls,
@@ -15,16 +17,18 @@ export function pythonWorkspaces() {
15
17
  fileParser: TOML.parse,
16
18
  nameExtractor: (data) => data.project.name,
17
19
  });
18
- processor.convert((data) => {
20
+ processor
21
+ .convert((data) => {
19
22
  const deployment = data.tool?.devops?.deployment;
20
23
  const scripts = data.tool?.devops?.scripts;
21
24
  const dependencyNames = data.project.dependencies ?? [];
22
25
  return {
23
26
  scripts,
24
27
  deployment,
25
- dependencyNames: processor.filterDependencies(dependencyNames)
28
+ dependencyNames: processor.filterDependencies(dependencyNames),
26
29
  };
27
- }).forEach(pkgData => {
30
+ })
31
+ .forEach((pkgData) => {
28
32
  _workspaces[pkgData.name] = pkgData;
29
33
  });
30
34
  console.warn(chalk.yellow(
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vaharoni/devops",
3
3
  "type": "module",
4
- "version": "1.1.4",
4
+ "version": "1.1.6",
5
5
  "description": "Devops utility",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
package/src/cli/common.ts CHANGED
@@ -251,7 +251,7 @@ export class CommandExecutor {
251
251
  const envPrefix = this.env ? this._envInjectorPrefix() : "";
252
252
  const fullCommand = [envPrefix, this.commandStr].join(" ").trim();
253
253
 
254
- const envPrefixLog = this.env ? `MONOREPO_ENV=${this.env}` : "";
254
+ const envPrefixLog = this.env ? `MONOREPO_ENV=${this.env} MONOREPO_ROOT=${process.cwd()}` : "";
255
255
  const fullCommandLog = [envPrefixLog, fullCommand].join(" ").trim();
256
256
  if (this.redactedCommand) {
257
257
  console.warn(
@@ -267,7 +267,7 @@ export class CommandExecutor {
267
267
  }
268
268
 
269
269
  _getProcessEnv(envOverride = {}) {
270
- return { ...process.env, MONOREPO_ENV: this.env, ...envOverride };
270
+ return { ...process.env, MONOREPO_ENV: this.env, MONOREPO_ROOT: process.cwd(), ...envOverride };
271
271
  }
272
272
 
273
273
  _envInjectorPrefix() {
@@ -11,14 +11,14 @@ export function workspaces() {
11
11
  const nodeWorkspacesData = nodeWorkspaces();
12
12
  const pythonWorkspacesData = pythonWorkspaces();
13
13
 
14
- Object.values(nodeWorkspacesData).forEach(data => {
14
+ Object.values(nodeWorkspacesData).forEach((data) => {
15
15
  _workspaces[data.name] = {
16
16
  rootPath: data.rootPath,
17
- packageDataEntries: [data]
17
+ packageDataEntries: [data],
18
18
  };
19
- })
19
+ });
20
20
 
21
- Object.values(pythonWorkspacesData).forEach(data => {
21
+ Object.values(pythonWorkspacesData).forEach((data) => {
22
22
  const existing = _workspaces[data.name];
23
23
  if (existing) {
24
24
  if (existing.rootPath !== data.rootPath) {
@@ -29,11 +29,11 @@ export function workspaces() {
29
29
  } else {
30
30
  _workspaces[data.name] = {
31
31
  rootPath: data.rootPath,
32
- packageDataEntries: []
32
+ packageDataEntries: [],
33
33
  };
34
34
  }
35
35
  _workspaces[data.name].packageDataEntries.push(data);
36
- })
36
+ });
37
37
  _workspacesLoaded = true;
38
38
  return _workspaces;
39
39
  }
@@ -5,7 +5,8 @@ import path from "path";
5
5
  import { packageFileNodeSchema, type PackageData } from "../../types";
6
6
  import { PackageDataProcessor } from "./process-common";
7
7
 
8
- const rootPkgJsonPath = path.join(process.cwd(), "package.json");
8
+ const rootPath = process.env.MONOREPO_ROOT || process.cwd();
9
+ const rootPkgJsonPath = path.join(rootPath, "package.json");
9
10
  const rootPkgJson = JSON.parse(fs.readFileSync(rootPkgJsonPath, "utf8")) as {
10
11
  workspaces: string[];
11
12
  };
@@ -15,8 +16,9 @@ let _workspacesLoaded = false;
15
16
 
16
17
  export function nodeWorkspaces() {
17
18
  if (!_workspacesLoaded) {
18
- const allPackageJsons = (rootPkgJson.workspaces ?? []).flatMap((workspaceGlob) =>
19
- globSync(path.join(workspaceGlob, "package.json"))
19
+ const allPackageJsons = (rootPkgJson.workspaces ?? []).flatMap(
20
+ (workspaceGlob) =>
21
+ globSync(path.join(rootPath, workspaceGlob, "package.json"))
20
22
  );
21
23
 
22
24
  const processor = new PackageDataProcessor({
@@ -27,13 +29,18 @@ export function nodeWorkspaces() {
27
29
  nameExtractor: (data) => data.name,
28
30
  });
29
31
 
30
- processor.convert((data) => {
31
- const { dependencies, ...rest } = data;
32
- const dependencyNames = Object.keys(dependencies ?? []);
33
- return { ...rest, dependencyNames: processor.filterDependencies(dependencyNames) };
34
- }).forEach(pkgData => {
35
- _workspaces[pkgData.name] = pkgData
36
- })
32
+ processor
33
+ .convert((data) => {
34
+ const { dependencies, ...rest } = data;
35
+ const dependencyNames = Object.keys(dependencies ?? []);
36
+ return {
37
+ ...rest,
38
+ dependencyNames: processor.filterDependencies(dependencyNames),
39
+ };
40
+ })
41
+ .forEach((pkgData) => {
42
+ _workspaces[pkgData.name] = pkgData;
43
+ });
37
44
 
38
45
  console.warn(
39
46
  chalk.yellow(
@@ -44,4 +51,4 @@ export function nodeWorkspaces() {
44
51
  _workspacesLoaded = true;
45
52
  }
46
53
  return _workspaces;
47
- }
54
+ }
@@ -2,14 +2,18 @@ import chalk from "chalk";
2
2
  import { globSync } from "glob";
3
3
  import { packageFilePythonSchema, type PackageData } from "../../types";
4
4
  import { PackageDataProcessor } from "./process-common";
5
- import TOML from '@iarna/toml';
5
+ import TOML from "@iarna/toml";
6
+ import path from "path";
6
7
 
8
+ const rootPath = process.env.MONOREPO_ROOT || process.cwd();
7
9
  const _workspaces: Record<string, PackageData> = {};
8
10
  let _workspacesLoaded = false;
9
11
 
10
12
  export function pythonWorkspaces() {
11
13
  if (!_workspacesLoaded) {
12
- const allPyprojectTomls = globSync("**/*/pyproject.toml");
14
+ const allPyprojectTomls = globSync(
15
+ path.join(rootPath, "**/*/pyproject.toml")
16
+ );
13
17
  const processor = new PackageDataProcessor({
14
18
  language: "python",
15
19
  pathList: allPyprojectTomls,
@@ -18,18 +22,20 @@ export function pythonWorkspaces() {
18
22
  nameExtractor: (data) => data.project.name,
19
23
  });
20
24
 
21
- processor.convert((data) => {
22
- const deployment = data.tool?.devops?.deployment;
23
- const scripts = data.tool?.devops?.scripts;
24
- const dependencyNames = data.project.dependencies ?? [];
25
- return {
26
- scripts,
27
- deployment,
28
- dependencyNames: processor.filterDependencies(dependencyNames)
29
- }
30
- }).forEach(pkgData => {
31
- _workspaces[pkgData.name] = pkgData
32
- })
25
+ processor
26
+ .convert((data) => {
27
+ const deployment = data.tool?.devops?.deployment;
28
+ const scripts = data.tool?.devops?.scripts;
29
+ const dependencyNames = data.project.dependencies ?? [];
30
+ return {
31
+ scripts,
32
+ deployment,
33
+ dependencyNames: processor.filterDependencies(dependencyNames),
34
+ };
35
+ })
36
+ .forEach((pkgData) => {
37
+ _workspaces[pkgData.name] = pkgData;
38
+ });
33
39
 
34
40
  console.warn(
35
41
  chalk.yellow(
@@ -40,4 +46,4 @@ export function pythonWorkspaces() {
40
46
  _workspacesLoaded = true;
41
47
  }
42
48
  return _workspaces;
43
- }
49
+ }
@@ -29,11 +29,11 @@ jobs:
29
29
  - name: Setup prerequesites
30
30
  uses: ./.github/actions/setup-prereq@v1
31
31
 
32
- - name: Connect to infrastructure
33
- uses: ./.github/actions/connect-to-infra@v1
32
+ - name: Connect to Digital Ocean
33
+ uses: ./.github/actions/connect-to-digital-ocean@v1
34
34
  with:
35
- do_access_token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
36
- do_cluster_name: ${{ secrets.DIGITALOCEAN_CLUSTER_NAME }}
35
+ access_token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
36
+ cluster_name: ${{ secrets.DIGITALOCEAN_CLUSTER_NAME }}
37
37
 
38
38
  - name: Build image
39
39
  uses: ./.github/actions/build-image@v1
@@ -54,12 +54,12 @@ jobs:
54
54
  - name: Setup prerequesites
55
55
  uses: ./.github/actions/setup-prereq@v1
56
56
 
57
- - name: Connect to infrastructure
58
- uses: ./.github/actions/connect-to-infra@v1
57
+ - name: Connect to Digital Ocean
58
+ uses: ./.github/actions/connect-to-digital-ocean@v1
59
59
  with:
60
- do_access_token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
61
- do_cluster_name: ${{ secrets.DIGITALOCEAN_CLUSTER_NAME }}
62
-
60
+ access_token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
61
+ cluster_name: ${{ secrets.DIGITALOCEAN_CLUSTER_NAME }}
62
+
63
63
  - name: Run DB Migrate
64
64
  uses: ./.github/actions/db-migrate@v1
65
65
 
@@ -29,13 +29,13 @@ jobs:
29
29
  - name: Setup prerequesites
30
30
  uses: ./.github/actions/setup-prereq@v1
31
31
 
32
- - name: Connect to infrastructure
33
- uses: ./.github/actions/connect-to-infra@v1
32
+ - name: Connect to Google Cloud GKE
33
+ uses: ./.github/actions/connect-to-gke@v1
34
34
  with:
35
- gcloud_project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
36
- gcloud_zone: ${{ secrets.GCLOUD_ZONE }}
37
- gcloud_cluster_name: ${{ secrets.GCLOUD_CLUSTER_NAME }}
38
- gcloud_service_account_key: ${{ secrets.GCLOUD_SA_KEY }}
35
+ project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
36
+ zone: ${{ secrets.GCLOUD_ZONE }}
37
+ cluster_name: ${{ secrets.GCLOUD_CLUSTER_NAME }}
38
+ service_account_key: ${{ secrets.GCLOUD_SA_KEY }}
39
39
 
40
40
  - name: Build image
41
41
  uses: ./.github/actions/build-image@v1
@@ -56,13 +56,13 @@ jobs:
56
56
  - name: Setup prerequesites
57
57
  uses: ./.github/actions/setup-prereq@v1
58
58
 
59
- - name: Connect to infrastructure
60
- uses: ./.github/actions/connect-to-infra@v1
59
+ - name: Connect to Google Cloud GKE
60
+ uses: ./.github/actions/connect-to-gke@v1
61
61
  with:
62
- gcloud_project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
63
- gcloud_zone: ${{ secrets.GCLOUD_ZONE }}
64
- gcloud_cluster_name: ${{ secrets.GCLOUD_CLUSTER_NAME }}
65
- gcloud_service_account_key: ${{ secrets.GCLOUD_SA_KEY }}
62
+ project_id: ${{ secrets.GCLOUD_PROJECT_ID }}
63
+ zone: ${{ secrets.GCLOUD_ZONE }}
64
+ cluster_name: ${{ secrets.GCLOUD_CLUSTER_NAME }}
65
+ service_account_key: ${{ secrets.GCLOUD_SA_KEY }}
66
66
 
67
67
  - name: Run DB Migrate
68
68
  uses: ./.github/actions/db-migrate@v1
@@ -29,12 +29,12 @@ jobs:
29
29
  - name: Setup prerequesites
30
30
  uses: ./.github/actions/setup-prereq@v1
31
31
 
32
- - name: Connect to infrastructure
33
- uses: ./.github/actions/connect-to-infra@v1
32
+ - name: Connect to Hetzner
33
+ uses: ./.github/actions/connect-to-hetzner@v1
34
34
  with:
35
- hetzner_kubeconfig: ${{ secrets.HCLOUD_KUBECONFIG }}
35
+ kubeconfig: ${{ secrets.HCLOUD_KUBECONFIG }}
36
36
  harbor_user: ${{ secrets.HARBOR_USER }}
37
- harbor_password: ${{ secrets.HARBOR_PASSWORD }}
37
+ harbor_password: ${{ secrets.HARBOR_PASSWORD }}
38
38
 
39
39
  - name: Build image
40
40
  uses: ./.github/actions/build-image@v1
@@ -55,12 +55,12 @@ jobs:
55
55
  - name: Setup prerequesites
56
56
  uses: ./.github/actions/setup-prereq@v1
57
57
 
58
- - name: Connect to infrastructure
59
- uses: ./.github/actions/connect-to-infra@v1
58
+ - name: Connect to Hetzner
59
+ uses: ./.github/actions/connect-to-hetzner@v1
60
60
  with:
61
- hetzner_kubeconfig: ${{ secrets.HCLOUD_KUBECONFIG }}
61
+ kubeconfig: ${{ secrets.HCLOUD_KUBECONFIG }}
62
62
  harbor_user: ${{ secrets.HARBOR_USER }}
63
- harbor_password: ${{ secrets.HARBOR_PASSWORD }}
63
+ harbor_password: ${{ secrets.HARBOR_PASSWORD }}
64
64
 
65
65
  - name: Run DB Migrate
66
66
  uses: ./.github/actions/db-migrate@v1
@@ -1,67 +0,0 @@
1
- name: "Connect to the infrastructure"
2
- description: "Convenience action to connect either to Digital Ocean or Hetzner based on the inputs provided"
3
- inputs:
4
- do_access_token:
5
- description: "DigitalOcean access token"
6
- required: false
7
- do_cluster_name:
8
- description: "DigitalOcean cluster name"
9
- required: false
10
- hetzner_kubeconfig:
11
- description: "The Hetzner kubeconfig file"
12
- required: false
13
- harbor_user:
14
- description: "The user name for the harbor registry"
15
- required: false
16
- harbor_password:
17
- description: "The password for the harbor registry"
18
- required: false
19
- gcloud_project_id:
20
- description: "Google Cloud project ID"
21
- required: false
22
- gcloud_zone:
23
- description: "Google Cloud GKE zone (e.g., us-central1)"
24
- required: false
25
- gcloud_cluster_name:
26
- description: "Google Cloud GKE cluster name"
27
- required: false
28
- gcloud_service_account_key:
29
- description: "Google Cloud service account key in JSON format"
30
- required: false
31
- outputs:
32
- infra:
33
- description: "Which infrastructure is being used"
34
- value: steps.determine_infrastructure.outputs.infra
35
- runs:
36
- using: "composite"
37
- steps:
38
- - name: Determine the infrastructure
39
- id: determine_infrastructure
40
- shell: bash
41
- run: |
42
- INFRA=$(devops constant infra)
43
- echo "infra=$INFRA" >> $GITHUB_OUTPUT
44
-
45
- - name: Connect to Digital Ocean
46
- if: steps.determine_infrastructure.outputs.infra == 'digitalocean'
47
- uses: ./.github/actions/connect-to-digital-ocean@v1
48
- with:
49
- access_token: ${{ inputs.do_access_token }}
50
- cluster_name: ${{ inputs.do_cluster_name }}
51
-
52
- - name: Connect to Hetzner
53
- if: steps.determine_infrastructure.outputs.infra == 'hetzner'
54
- uses: ./.github/actions/connect-to-hetzner@v1
55
- with:
56
- kubeconfig: ${{ inputs.hetzner_kubeconfig }}
57
- harbor_user: ${{ inputs.harbor_user }}
58
- harbor_password: ${{ inputs.harbor_password }}
59
-
60
- - name: Connect to Google Cloud GKE
61
- if: steps.determine_infrastructure.outputs.infra == 'gcloud'
62
- uses: ./.github/actions/connect-to-gke@v1
63
- with:
64
- project_id: ${{ inputs.gcloud_project_id }}
65
- zone: ${{ inputs.gcloud_zone }}
66
- cluster_name: ${{ inputs.gcloud_cluster_name }}
67
- service_account_key: ${{ inputs.gcloud_service_account_key }}