Build Base #965
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 Base | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: "Select branch" | |
required: true | |
type: choice | |
options: | |
- master | |
- release-1.12 | |
- release-1.11 | |
- release-1.9 | |
- release-1.12-mc | |
schedule: | |
- cron: "20 19 * * *" | |
jobs: | |
build-amd64: | |
strategy: | |
fail-fast: false | |
matrix: | |
branch: | |
- master | |
- release-1.12 | |
- release-1.11 | |
- release-1.9 | |
- release-1.12-mc | |
name: Build AMD64 | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
with: | |
ref: ${{ matrix.branch }} | |
- uses: docker/setup-buildx-action@v3 | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
- uses: actions/setup-go@v5 | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
id: setup-go | |
with: | |
go-version-file: go.mod | |
check-latest: true | |
cache: false | |
- name: Build | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
env: | |
GO_VERSION: ${{ steps.setup-go.outputs.go-version }} | |
run: | | |
make base-amd64 | |
make base-tar-amd64 | |
- name: Upload image to artifact | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: image-amd64-${{ matrix.branch }} | |
path: image-amd64.tar | |
retention-days: 7 | |
build-arm64: | |
strategy: | |
fail-fast: false | |
matrix: | |
branch: | |
- master | |
- release-1.12 | |
- release-1.11 | |
- release-1.9 | |
- release-1.12-mc | |
name: Build ARM64 | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
with: | |
ref: ${{ matrix.branch }} | |
- uses: docker/setup-buildx-action@v3 | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
- uses: docker/setup-qemu-action@v3 | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
with: | |
platforms: arm64 | |
- uses: actions/setup-go@v5 | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
id: setup-go | |
with: | |
go-version-file: go.mod | |
check-latest: true | |
cache: false | |
- name: Build | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
env: | |
GO_VERSION: ${{ steps.setup-go.outputs.go-version }} | |
run: | | |
make base-arm64 || make base-arm64 | |
make base-tar-arm64 | |
- name: Upload image to artifact | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
uses: actions/upload-artifact@v4 | |
with: | |
name: image-arm64-${{ matrix.branch }} | |
path: image-arm64.tar | |
retention-days: 7 | |
push: | |
strategy: | |
fail-fast: false | |
matrix: | |
branch: | |
- master | |
- release-1.12 | |
- release-1.11 | |
- release-1.9 | |
- release-1.12-mc | |
needs: | |
- build-arm64 | |
- build-amd64 | |
name: push | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
with: | |
ref: ${{ matrix.branch }} | |
- name: Download image | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
uses: actions/download-artifact@v4 | |
with: | |
name: image-amd64-${{ matrix.branch }} | |
- name: Download image | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
uses: actions/download-artifact@v4 | |
with: | |
name: image-arm64-${{ matrix.branch }} | |
- name: Load Image | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
run: | | |
docker load --input image-amd64.tar | |
docker load --input image-arm64.tar | |
- name: Push | |
if: (github.event.inputs.branch || matrix.branch) == matrix.branch | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
COMMIT: ${{ github.sha }} | |
run: | | |
cat VERSION | |
TAG=$(cat VERSION) | |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | |
docker images | |
docker push kubeovn/kube-ovn-base:$TAG-amd64 | |
docker push kubeovn/kube-ovn-base:$TAG-arm64 | |
docker manifest create kubeovn/kube-ovn-base:$TAG kubeovn/kube-ovn-base:$TAG-amd64 kubeovn/kube-ovn-base:$TAG-arm64 | |
docker manifest push kubeovn/kube-ovn-base:$TAG | |
if [ "${{ matrix.branch }}" = "master" -o "`printf '${{ matrix.branch }}\nrelease-1.11' | sort -Vr | head -n1`" = "${{ matrix.branch }}" ]; then | |
docker push kubeovn/kube-ovn-base:$TAG-debug-amd64 | |
docker push kubeovn/kube-ovn-base:$TAG-debug-arm64 | |
docker manifest create kubeovn/kube-ovn-base:$TAG-debug kubeovn/kube-ovn-base:$TAG-debug-amd64 kubeovn/kube-ovn-base:$TAG-debug-arm64 | |
docker manifest push kubeovn/kube-ovn-base:$TAG-debug | |
fi | |
if [ "${{ matrix.branch }}" = "master" -o "`printf '${{ matrix.branch }}\nrelease-1.13' | sort -Vr | head -n1`" = "${{ matrix.branch }}" ]; then | |
docker push kubeovn/kube-ovn-base:$TAG-amd64-legacy | |
fi |