Build #2495
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 | |
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@v2 | |
- name: Install curl and jq | |
run: sudo apt-get install curl jq | |
- name: Extract git hashes and latest version | |
id: git_info | |
run: | | |
echo "::set-output name=mlrun_commit_hash::$(git rev-parse --short=8 $GITHUB_SHA)" | |
echo "::set-output name=unstable_version_prefix::$(curl https://raw.githubusercontent.com/mlrun/mlrun/${GITHUB_REF##*/}/automation/version/unstable_version_prefix)" | |
- name: Set computed versions params | |
id: computed_params | |
run: | | |
echo "::set-output name=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`})" | |
echo "::set-output name=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`})" | |
echo "::set-output name=mlrun_docker_registries::$( \ | |
input_docker_registries=${{ github.event.inputs.docker_registries }} && \ | |
echo ${input_docker_registries:-ghcr.io/})" | |
- name: Setup Node.js 12 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '12' | |
- name: Docker login | |
# all suffixed with "| true" to allow failures if secrets are not defined (fork) | |
run: | | |
echo ${{ secrets.GHCR_DOCKER_REGISTRY_PASSWORD }} | \ | |
docker login ghcr.io -u ${{ secrets.GHCR_DOCKER_REGISTRY_USERNAME }} --password-stdin | true | |
echo ${{ secrets.DOCKER_HUB_DOCKER_REGISTRY_PASSWORD }} | \ | |
docker login registry.hub.docker.com -u ${{ secrets.DOCKER_HUB_DOCKER_REGISTRY_USERNAME }} \ | |
--password-stdin | true | |
echo ${{ secrets.QUAY_IO_DOCKER_REGISTRY_PASSWORD }} | \ | |
docker login quay.io -u ${{ secrets.QUAY_IO_DOCKER_REGISTRY_USERNAME }} \ | |
--password-stdin | true | |
- name: Build & push image | |
run: | | |
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=${{ steps.computed_params.outputs.mlrun_version }} \ | |
npm run docker; \ | |
docker push ${registry}${{ steps.computed_params.outputs.mlrun_docker_repo }}/mlrun-ui:${{ steps.computed_params.outputs.mlrun_version }}; \ | |
done; |