diff --git a/.github/workflows/build-and-push.yml b/.github/workflows/build-and-push.yml index 5108415..a802e63 100644 --- a/.github/workflows/build-and-push.yml +++ b/.github/workflows/build-and-push.yml @@ -5,7 +5,6 @@ on: branches: [main] tags: - v* - pull_request: jobs: test: @@ -23,49 +22,22 @@ jobs: build: needs: test runs-on: ubuntu-latest - if: github.event_name == 'push' - env: - IMAGE_NAME: rest-proxy - + IMAGE_NAME: kserve/rest-proxy steps: - uses: actions/checkout@v2 - - - name: Setup QEMU - uses: docker/setup-qemu-action@v2 - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USER }} - password: ${{ secrets.DOCKER_ACCESS_TOKEN }} - - - name: export version variables + - 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: | - IMAGE_ID=kserve/$IMAGE_NAME - - # Change all uppercase to lowercase - IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') - # Strip git ref prefix from version VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - - # Strip "v" prefix from tag name - # [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') + echo $VERSION # Use Docker `latest` tag convention [ "$VERSION" == "main" ] && VERSION=latest - echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "IMAGE_ID=$IMAGE_ID" >> $GITHUB_ENV - - - name: Build and push - uses: docker/build-push-action@v3 - with: - platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x - push: true - tags: ${{ env.IMAGE_ID }}:${{ env.VERSION }} - target: runtime + docker tag ${{ env.IMAGE_NAME }}:latest ${{ env.IMAGE_NAME }}:$VERSION + docker push ${{ env.IMAGE_NAME }}:$VERSION