Build #4360
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2019 Iguazio | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
name: Build | |
permissions: | |
# Allow the action to upload images to ghcr | |
packages: write | |
on: | |
push: | |
branches: | |
- development | |
- '[0-9]+.[0-9]+.x' | |
workflow_dispatch: | |
inputs: | |
docker_registries: | |
description: 'Comma separated list of docker registries to push images to (default: ghcr.io/, use registry.hub.docker.com/ for docker hub)' | |
required: true | |
default: 'ghcr.io/' | |
docker_repo: | |
description: 'Docker repo to push images to (default: lowercase github repository owner name)' | |
required: false | |
default: '' | |
version: | |
description: 'The version to build, without prefix v (e.g. 1.1.0), if not provided version will be <latest-release>-<commit-hash>' | |
required: false | |
default: '' | |
jobs: | |
build-images: | |
name: Build and push ui image | |
runs-on: ubuntu-latest | |
# let's not run this on every fork, change to your fork when developing | |
if: github.repository == 'mlrun/ui' || github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install curl and jq | |
run: sudo apt-get install curl jq | |
- name: Extract git hashes and latest version | |
id: git_info | |
run: | | |
echo "mlrun_commit_hash=$(git rev-parse --short=8 $GITHUB_SHA)" >> $GITHUB_OUTPUT | |
echo "unstable_version_prefix=$(curl https://raw.githubusercontent.com/mlrun/mlrun/${GITHUB_REF##*/}/automation/version/unstable_version_prefix)" >> $GITHUB_OUTPUT | |
- name: Set computed versions params | |
id: computed_params | |
run: | | |
echo "mlrun_version=$( \ | |
input_mlrun_version=${{ github.event.inputs.version }} && \ | |
default_mlrun_version=$(echo ${{ steps.git_info.outputs.unstable_version_prefix }}-${{ steps.git_info.outputs.mlrun_commit_hash }}) && \ | |
echo ${input_mlrun_version:-`echo $default_mlrun_version`})" >> $GITHUB_OUTPUT | |
echo "mlrun_docker_repo=$( \ | |
input_docker_repo=${{ github.event.inputs.docker_repo }} && \ | |
default_docker_repo=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') && \ | |
echo ${input_docker_repo:-`echo $default_docker_repo`})" >> $GITHUB_OUTPUT | |
echo "mlrun_docker_registries=$( \ | |
input_docker_registries=${{ github.event.inputs.docker_registries }} && \ | |
echo ${input_docker_registries:-ghcr.io/})" >> $GITHUB_OUTPUT | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
- name: Docker login (ghcr) | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker login (quay.io) | |
continue-on-error: true | |
uses: docker/login-action@v2 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_IO_DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.QUAY_IO_DOCKER_REGISTRY_PASSWORD }} | |
- name: Docker login (docker.com) | |
continue-on-error: true | |
uses: docker/login-action@v2 | |
with: | |
registry: registry.hub.docker.com | |
username: ${{ secrets.DOCKER_HUB_DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_DOCKER_REGISTRY_PASSWORD }} | |
- name: Build & push image | |
run: | | |
# if the provided version includes a "+" we replace it with "-" for the docker tag | |
tag=$(echo "$MLRUN_VERSION" | sed -E 's/\+/\-/g') | |
for registry in $(echo ${{ steps.computed_params.outputs.mlrun_docker_registries }} | sed "s/,/ /g"); \ | |
do \ | |
MLRUN_DOCKER_REGISTRY=$registry \ | |
MLRUN_DOCKER_REPO=${{ steps.computed_params.outputs.mlrun_docker_repo }} \ | |
MLRUN_DOCKER_TAG=$tag \ | |
npm run docker; \ | |
docker push ${registry}${{ steps.computed_params.outputs.mlrun_docker_repo }}/mlrun-ui:$tag; \ | |
done; | |
env: | |
MLRUN_VERSION: ${{ steps.computed_params.outputs.mlrun_version }} |