Skip to content

release-image-build #10

release-image-build

release-image-build #10

name: release-image-build
on:
workflow_dispatch:
inputs:
commit:
description: 'Commit reference (branch or SHA) from which to build the images.'
required: true
tag:
description: 'Desired release version tag (e.g. v0.5.0-rc.0).'
required: true
jobs:
release_apiserver_image:
env:
working-directory: ./apiserver
name: Release APIServer Docker Image
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.17.x
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.commit }}
- name: install kubebuilder
run: |
wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v3.0.0/kubebuilder_$(go env GOOS)_$(go env GOARCH)
sudo mv kubebuilder_$(go env GOOS)_$(go env GOARCH) /usr/local/bin/kubebuilder
- name: Get revision SHA
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Get dependencies
run: go mod download
working-directory: ${{env.working-directory}}
- name: Build
run: go build ./...
working-directory: ${{env.working-directory}}
- name: Test
run: go test ./...
working-directory: ${{env.working-directory}}
- name: Set up Docker
uses: docker-practice/actions-setup-docker@master
- name: Build Docker Image - Apiserver
run: |
docker build -t kuberay/apiserver:${{ steps.vars.outputs.sha_short }} -f apiserver/Dockerfile .
docker save -o /tmp/apiserver.tar kuberay/apiserver:${{ steps.vars.outputs.sha_short }}
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Apiserver to DockerHub
run: |
docker push kuberay/apiserver:${{ steps.vars.outputs.sha_short }};
docker image tag kuberay/apiserver:${{ steps.vars.outputs.sha_short }} kuberay/apiserver:${{ github.event.inputs.tag }};
docker push kuberay/apiserver:${{ github.event.inputs.tag }}
release_operator_image:
env:
working-directory: ./ray-operator
name: Release Operator Docker Images
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.17.x
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.commit }}
- name: install kubebuilder
run: |
wget https://github.com/kubernetes-sigs/kubebuilder/releases/download/v3.0.0/kubebuilder_$(go env GOOS)_$(go env GOARCH)
sudo mv kubebuilder_$(go env GOOS)_$(go env GOARCH) /usr/local/bin/kubebuilder
- name: Get revision SHA
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Get dependencies
run: go mod download
working-directory: ${{env.working-directory}}
- name: Build
run: make build
working-directory: ${{env.working-directory}}
- name: Test
run: make test
working-directory: ${{env.working-directory}}
- name: Set up Docker
uses: docker-practice/actions-setup-docker@master
- name: Build Docker Image - Operator
run: |
IMG=kuberay/operator:${{ steps.vars.outputs.sha_short }} make docker-image
working-directory: ${{env.working-directory}}
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Push Operator to DockerHub
run: |
docker push kuberay/operator:${{ steps.vars.outputs.sha_short }};
docker image tag kuberay/operator:${{ steps.vars.outputs.sha_short }} kuberay/operator:${{ github.event.inputs.tag }};
docker push kuberay/operator:${{ github.event.inputs.tag }}