diff --git a/.github/workflows/on-release.yaml b/.github/workflows/on-release.yaml index ec6f6a8a..ff5f7a42 100644 --- a/.github/workflows/on-release.yaml +++ b/.github/workflows/on-release.yaml @@ -71,6 +71,22 @@ jobs: sbom: true tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.nextVersion }} + - name: Install OCM CLI + run: | + sudo curl -sL https://raw.githubusercontent.com/open-component-model/ocm/main/install.sh | sudo bash + + - name: Install Go-Task + uses: arduino/setup-task@v2 + with: + version: 3.x + repo-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Build OCM component + run: task build:ocm -- ${{ github.event.inputs.nextVersion }} + + - name: Publish OCM component + run: task publish:ocm + - name: Create Release with autogenerated release notes env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index ed12b496..2d0ce0cf 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ public/frontend-config.json # Sentry Config File .env.sentry-build-plugin + +# OCM build artifacts +.ctf/ diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 00000000..97fb7e37 --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,54 @@ +version: "3" + +vars: + # Variables for Docker image + REGISTRY: {{.REGISTRY | default (print "ghcr.io/openmcp-project") }} + IMAGE_NAME: mcp-ui-frontend + IMAGE_TAG: '{{.TAG | default "latest"}}' + DOCKER_IMAGE: "{{.REGISTRY}}/{{.IMAGE_NAME}}:{{.IMAGE_TAG}}" + + # Variables for OCM component + OCM_COMPONENT_NAME: github.com/openmcp-project/ui + OCM_COMPONENT_VERSION: '{{.OCM_COMPONENT_VERSION | default .IMAGE_TAG}}' + OCM_PROVIDER: openmcp-project + OCM_TARGET_REPO: '{{.OCM_TARGET_REPO | default (print .REGISTRY "/components") }}' + OCM_OUTPUT_DIR: "{{.ROOT_DIR}}/.ctf" + OCM_DESCRIPTOR: "{{.ROOT_DIR}}/ocm/component-descriptor.yaml" + +tasks: + default: + desc: Show available tasks + cmds: + - task --list + + build:ocm: + desc: "Builds the ocm component. Usage: task build:ocm -- " + cmds: + - rm -rf {{.OCM_OUTPUT_DIR}} + - | + ocm add components --create \ + --lookup {{.OCM_TARGET_REPO}} \ + --file {{.OCM_OUTPUT_DIR}} \ + {{.OCM_DESCRIPTOR}} -- \ + VERSION={{.OCM_COMPONENT_VERSION}} \ + COMPONENT_NAME={{.OCM_COMPONENT_NAME}} \ + PROVIDER={{.OCM_PROVIDER}} + vars: + OCM_COMPONENT_VERSION: '{{.CLI_ARGS}}' + + publish:ocm: + desc: "Publishes the ocm component to the registry." + cmds: + - | + ocm transfer ctf \ + {{.OCM_OUTPUT_DIR}} {{.OCM_TARGET_REPO}} + + build:image:local: + desc: "Builds the docker image for local testing. Usage: task test:build-image TAG=v-local-test" + cmds: + - docker build -t {{.DOCKER_IMAGE}} . + + publish:image:local: + desc: "Publishes the docker image for local testing. Usage: task test:publish-image TAG=v-local-test" + cmds: + - docker push {{.DOCKER_IMAGE}} \ No newline at end of file diff --git a/ocm/component-descriptor.yaml b/ocm/component-descriptor.yaml new file mode 100644 index 00000000..59c09165 --- /dev/null +++ b/ocm/component-descriptor.yaml @@ -0,0 +1,13 @@ +name: ${COMPONENT_NAME} +version: ${VERSION} +provider: + name: ${PROVIDER} +sources: [] +componentReferences: [] +resources: + - name: mcp-ui-frontend-image + type: ociImage + version: ${VERSION} + access: + type: ociArtifact + imageReference: ghcr.io/openmcp-project/mcp-ui-frontend:${VERSION} \ No newline at end of file