|
| 1 | +version: '3' |
| 2 | + |
| 3 | +vars: |
| 4 | + # Variables for Docker image |
| 5 | + REGISTRY: '{{.REGISTRY | default (print "ghcr.io/openmcp-project") }}' |
| 6 | + IMAGE_NAME: mcp-ui-frontend |
| 7 | + IMAGE_TAG: '{{.TAG | default "latest"}}' |
| 8 | + DOCKER_IMAGE: '{{.REGISTRY}}/{{.IMAGE_NAME}}:{{.IMAGE_TAG}}' |
| 9 | + |
| 10 | + # Variables for OCM component |
| 11 | + OCM_COMPONENT_NAME: github.com/openmcp-project/ui |
| 12 | + OCM_COMPONENT_VERSION: '{{.OCM_COMPONENT_VERSION | default .IMAGE_TAG}}' |
| 13 | + OCM_PROVIDER: openmcp-project |
| 14 | + 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' |
| 17 | + |
| 18 | + ROOT_DIR2: '{{.ROOT_DIR | trimSuffix "/common" | trimSuffix "/hack"}}' |
| 19 | + LOCALBIN: '{{ env "LOCALBIN" | default ( .LOCALBIN | default (print .ROOT_DIR2 "/.bin") ) }}' |
| 20 | + OCM: '{{ .OCM | default (print .LOCALBIN "/ocm") }}' |
| 21 | + |
| 22 | +tasks: |
| 23 | + default: |
| 24 | + desc: Show available tasks |
| 25 | + cmds: |
| 26 | + - task --list |
| 27 | + |
| 28 | + build:ocm: |
| 29 | + desc: 'Builds the ocm component. Usage: task build:ocm' |
| 30 | + deps: |
| 31 | + - install:ocm |
| 32 | + cmds: |
| 33 | + - rm -rf {{.OCM_OUTPUT_DIR}} |
| 34 | + - | |
| 35 | + {{.OCM}} add components --create \ |
| 36 | + --lookup {{.OCM_TARGET_REPO}} \ |
| 37 | + --file {{.OCM_OUTPUT_DIR}} \ |
| 38 | + {{.OCM_DESCRIPTOR}} -- \ |
| 39 | + VERSION={{.OCM_COMPONENT_VERSION}} \ |
| 40 | + IMAGE_VERSION={{.IMAGE_VERSION}} \ |
| 41 | + COMPONENT_NAME={{.OCM_COMPONENT_NAME}} \ |
| 42 | + PROVIDER={{.OCM_PROVIDER}} |
| 43 | + vars: |
| 44 | + IMAGE_VERSION: '{{.IMAGE_VERSION | default (print .OCM_COMPONENT_VERSION)}}' |
| 45 | + |
| 46 | + publish:ocm: |
| 47 | + desc: 'Publishes the ocm component to the registry. Usage: task publish:ocm [OCM_TRANSFER_ARGS="--overwrite"]' |
| 48 | + deps: |
| 49 | + - install:ocm |
| 50 | + cmds: |
| 51 | + - | |
| 52 | + {{.OCM}} transfer ctf \ |
| 53 | + {{.OCM_OUTPUT_DIR}} {{.OCM_TARGET_REPO}} {{.OCM_TRANSFER_ARGS}} |
| 54 | +
|
| 55 | + build:image:local: |
| 56 | + desc: 'Builds the docker image for local testing. Usage: task test:build-image TAG=v-local-test' |
| 57 | + cmds: |
| 58 | + - docker build -t {{.DOCKER_IMAGE}} . |
| 59 | + |
| 60 | + publish:image:local: |
| 61 | + desc: 'Publishes the docker image for local testing. Usage: task test:publish-image TAG=v-local-test' |
| 62 | + cmds: |
| 63 | + - docker push {{.DOCKER_IMAGE}} |
| 64 | + |
| 65 | + localbin: |
| 66 | + desc: ' Ensure that the folder specified in LOCALBIN exists.' |
| 67 | + run: once |
| 68 | + requires: |
| 69 | + vars: |
| 70 | + - LOCALBIN |
| 71 | + status: |
| 72 | + - test -d {{.LOCALBIN}} |
| 73 | + cmds: |
| 74 | + - 'echo "localbin: {{.LOCALBIN}}"' |
| 75 | + - mkdir -p {{.LOCALBIN}} |
| 76 | + internal: true |
| 77 | + |
| 78 | + install:ocm: |
| 79 | + desc: ' Ensure that the ocm CLI is installed.' |
| 80 | + run: once |
| 81 | + requires: |
| 82 | + vars: |
| 83 | + - OCM |
| 84 | + deps: |
| 85 | + - localbin |
| 86 | + status: |
| 87 | + - 'test -x "{{.OCM}}"' |
| 88 | + - '"{{.OCM}}" --version | grep -q "{{.OCM_VERSION | trimPrefix "v"}}"' |
| 89 | + vars: |
| 90 | + # renovate: datasource=github-releases depName=ocm packageName=open-component-model/ocm |
| 91 | + OCM_VERSION: '{{ env "OCM_VERSION" | default ( .OCM_VERSION | default "v0.30.0" ) }}' |
| 92 | + tmpdir: |
| 93 | + sh: 'mktemp -d' |
| 94 | + cmds: |
| 95 | + - 'curl -sSfL https://ocm.software/install.sh | OCM_VERSION="{{.OCM_VERSION | trimPrefix "v"}}" bash -s "{{.tmpdir}}"' |
| 96 | + - 'mv "{{.tmpdir}}/ocm" "{{.OCM}}"' |
0 commit comments