Merge pull request #120 from israel-hdez/add-mc-anti-affinity-0110 #5
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
name: Build and Push | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'release-*' | |
paths-ignore: | |
- 'docs/**' | |
- '**.md' | |
- '.github/**' | |
- '.tekton/**' | |
tags: | |
- v* | |
jobs: | |
# Ensure that tests pass before publishing a new image. | |
build: | |
runs-on: ubuntu-latest | |
env: | |
IMAGE_NAME: kserve/modelmesh-controller | |
CI: true | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build develop image | |
run: make build.develop | |
- name: Run lint | |
run: ./scripts/develop.sh make fmt | |
- name: Run unit tests | |
run: ./scripts/develop.sh make test | |
- name: Build runtime image | |
run: make build | |
- name: Log in to Docker Hub | |
run: docker login -u ${{ secrets.DOCKER_USER }} -p ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
- name: Push to Docker Hub | |
run: | | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
echo $VERSION | |
# Currently, we rely on nightly builds for pushing images, so exit if | |
# not a tag version for now. | |
if [ "$VERSION" == "main" ]; then | |
echo "Skipping image push" | |
VERSION=latest | |
exit 0 | |
fi | |
docker tag ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:$VERSION | |
docker push ${{ env.IMAGE_NAME }}:$VERSION |