Skip to content

Commit a18430a

Browse files
authored
feat: add OCM component build to main build workflow & refactors comp… (#341)
1 parent c6ecfcf commit a18430a

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

.github/workflows/main.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,12 @@ jobs:
6464
annotations: ${{ steps.meta.outputs.annotations }}
6565
cache-from: type=gha
6666
cache-to: type=gha,mode=max
67+
68+
- name: Build OCM component
69+
run: task build:ocm
70+
env:
71+
IMAGE_VERSION: "main"
72+
OCM_COMPONENT_VERSION: "v0.0.0-main"
73+
74+
- name: Publish OCM component
75+
run: task publish:ocm

.github/workflows/on-release.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88
inputs:
99
nextVersion:
10-
description: 'specify the release version in the semver format v[major].[minor].[patch] e.g. v0.0.0'
10+
description: "specify the release version in the semver format v[major].[minor].[patch] e.g. v0.0.0"
1111
required: true
1212

1313
# base permissions for all jobs should be minimal
@@ -82,7 +82,9 @@ jobs:
8282
repo-token: ${{ secrets.GITHUB_TOKEN }}
8383

8484
- name: Build OCM component
85-
run: task build:ocm -- ${{ github.event.inputs.nextVersion }}
85+
run: task build:ocm
86+
env:
87+
OCM_COMPONENT_VERSION: ${{ github.event.inputs.nextVersion }}
8688

8789
- name: Publish OCM component
8890
run: task publish:ocm

Taskfile.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
version: "3"
1+
version: '3'
22

33
vars:
44
# Variables for Docker image
5-
REGISTRY: {{.REGISTRY | default (print "ghcr.io/openmcp-project") }}
5+
REGISTRY: '{{.REGISTRY | default (print "ghcr.io/openmcp-project") }}'
66
IMAGE_NAME: mcp-ui-frontend
77
IMAGE_TAG: '{{.TAG | default "latest"}}'
8-
DOCKER_IMAGE: "{{.REGISTRY}}/{{.IMAGE_NAME}}:{{.IMAGE_TAG}}"
8+
DOCKER_IMAGE: '{{.REGISTRY}}/{{.IMAGE_NAME}}:{{.IMAGE_TAG}}'
99

1010
# Variables for OCM component
1111
OCM_COMPONENT_NAME: github.com/openmcp-project/ui
1212
OCM_COMPONENT_VERSION: '{{.OCM_COMPONENT_VERSION | default .IMAGE_TAG}}'
1313
OCM_PROVIDER: openmcp-project
1414
OCM_TARGET_REPO: '{{.OCM_TARGET_REPO | default (print .REGISTRY "/components") }}'
15-
OCM_OUTPUT_DIR: "{{.ROOT_DIR}}/.ctf"
16-
OCM_DESCRIPTOR: "{{.ROOT_DIR}}/ocm/component-descriptor.yaml"
15+
OCM_OUTPUT_DIR: '{{.ROOT_DIR}}/.ctf'
16+
OCM_DESCRIPTOR: '{{.ROOT_DIR}}/ocm/component-descriptor.yaml'
1717

1818
tasks:
1919
default:
@@ -22,7 +22,7 @@ tasks:
2222
- task --list
2323

2424
build:ocm:
25-
desc: "Builds the ocm component. Usage: task build:ocm -- <version>"
25+
desc: 'Builds the ocm component. Usage: task build:ocm'
2626
cmds:
2727
- rm -rf {{.OCM_OUTPUT_DIR}}
2828
- |
@@ -31,24 +31,25 @@ tasks:
3131
--file {{.OCM_OUTPUT_DIR}} \
3232
{{.OCM_DESCRIPTOR}} -- \
3333
VERSION={{.OCM_COMPONENT_VERSION}} \
34+
IMAGE_VERSION={{.IMAGE_VERSION}} \
3435
COMPONENT_NAME={{.OCM_COMPONENT_NAME}} \
3536
PROVIDER={{.OCM_PROVIDER}}
3637
vars:
37-
OCM_COMPONENT_VERSION: '{{.CLI_ARGS}}'
38+
IMAGE_VERSION: '{{.IMAGE_VERSION | default (print .OCM_COMPONENT_VERSION)}}'
3839

3940
publish:ocm:
40-
desc: "Publishes the ocm component to the registry."
41+
desc: 'Publishes the ocm component to the registry.'
4142
cmds:
4243
- |
4344
ocm transfer ctf \
4445
{{.OCM_OUTPUT_DIR}} {{.OCM_TARGET_REPO}}
4546
4647
build:image:local:
47-
desc: "Builds the docker image for local testing. Usage: task test:build-image TAG=v-local-test"
48+
desc: 'Builds the docker image for local testing. Usage: task test:build-image TAG=v-local-test'
4849
cmds:
4950
- docker build -t {{.DOCKER_IMAGE}} .
5051

5152
publish:image:local:
52-
desc: "Publishes the docker image for local testing. Usage: task test:publish-image TAG=v-local-test"
53+
desc: 'Publishes the docker image for local testing. Usage: task test:publish-image TAG=v-local-test'
5354
cmds:
54-
- docker push {{.DOCKER_IMAGE}}
55+
- docker push {{.DOCKER_IMAGE}}

ocm/component-descriptor.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ resources:
1010
version: ${VERSION}
1111
access:
1212
type: ociArtifact
13-
imageReference: ghcr.io/openmcp-project/mcp-ui-frontend:${VERSION}
13+
imageReference: ghcr.io/openmcp-project/mcp-ui-frontend:${IMAGE_VERSION}

0 commit comments

Comments
 (0)