Merge pull request #1059 from stoneshi-yunify/master #1375
Workflow file for this run
This file contains hidden or 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 | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Image Tag" | |
default: "latest" | |
pull_request: | |
branches: | |
- master | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*.*.*' | |
paths-ignore: | |
- "**.md" | |
- "LICENSE" | |
- "docs/**" | |
- ".devcontainer/**" | |
- "*.ya?ml" # ignore all yaml files(with suffix yaml or yml) in the root of the repository | |
- "!codecov.yml" | |
- "!.golangci.yml" | |
- "!config/**" | |
- "OWNERS" | |
- "PROJECT" | |
jobs: | |
BuildController: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare | |
id: prepare | |
run: | | |
VERSION=latest | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/} | |
fi | |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
VERSION=${{ github.event.inputs.tag }} | |
fi | |
echo ::set-output name=version::${VERSION} | |
- name: Docker meta for kubesphere | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
kubesphere/devops-controller | |
tags: ${{ steps.prepare.outputs.version }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_SECRETS }} | |
- name: Build env | |
id: build_env | |
run: | | |
if [ ${{ github.ref_type }} == "tag" ] | |
then | |
echo "::set-output name=platforms::linux/amd64,linux/arm64" | |
else | |
echo "::set-output name=platforms::linux/amd64" | |
fi | |
echo "::set-output name=push::true" | |
echo "::set-output name=ref::${{github.ref_name}}" | |
echo "::set-output name=short_sha::${GITHUB_SHA::7}" | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v6 | |
with: | |
file: config/dockerfiles/controller-manager/Dockerfile | |
tags: ${{ steps.meta.outputs.tags }} | |
push: ${{ steps.build_env.outputs.push }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: ${{ steps.build_env.outputs.platforms }} | |
BuildAPIServer: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare | |
id: prepare | |
run: | | |
VERSION=latest | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/} | |
fi | |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
VERSION=${{ github.event.inputs.tag }} | |
fi | |
echo ::set-output name=version::${VERSION} | |
- name: Docker meta for kubesphere | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
kubesphere/devops-apiserver | |
tags: ${{ steps.prepare.outputs.version }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_SECRETS }} | |
- name: Build env | |
id: build_env | |
run: | | |
if [ ${{ github.ref_type }} == "tag" ] | |
then | |
echo "::set-output name=platforms::linux/amd64,linux/arm64" | |
else | |
echo "::set-output name=platforms::linux/amd64" | |
fi | |
echo "::set-output name=push::true" | |
echo "::set-output name=ref::${{github.ref_name}}" | |
echo "::set-output name=short_sha::${GITHUB_SHA::7}" | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v6 | |
with: | |
file: config/dockerfiles/apiserver/Dockerfile | |
tags: ${{ steps.meta.outputs.tags }} | |
push: ${{ steps.build_env.outputs.push }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: ${{ steps.build_env.outputs.platforms }} | |
BuildTools: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Prepare | |
id: prepare | |
run: | | |
VERSION=latest | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/} | |
fi | |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
VERSION=${{ github.event.inputs.tag }} | |
fi | |
echo ::set-output name=version::${VERSION} | |
- name: Docker meta for kubesphere | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
kubesphere/devops-tools | |
tags: ${{ steps.prepare.outputs.version }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USER }} | |
password: ${{ secrets.DOCKER_HUB_SECRETS }} | |
- name: Build env | |
id: build_env | |
run: | | |
if [ ${{ github.ref_type }} == "tag" ] | |
then | |
echo "::set-output name=platforms::linux/amd64,linux/arm64" | |
else | |
echo "::set-output name=platforms::linux/amd64" | |
fi | |
echo "::set-output name=push::true" | |
echo "::set-output name=ref::${{github.ref_name}}" | |
echo "::set-output name=short_sha::${GITHUB_SHA::7}" | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v6 | |
with: | |
file: config/dockerfiles/tools/Dockerfile | |
tags: ${{ steps.meta.outputs.tags }} | |
push: ${{ steps.build_env.outputs.push }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: ${{ steps.build_env.outputs.platforms }} |