Skip to content

Commit

Permalink
add build action
Browse files Browse the repository at this point in the history
Signed-off-by: stoneshi-yunify <stoneshi@kubesphere.io>
  • Loading branch information
stoneshi-yunify committed Sep 5, 2024
1 parent 829d21d commit e37583a
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 3 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build

on:
workflow_dispatch:
inputs:
tag:
description: "Image Tag"
default: "latest"
push:
branches:
- 'main'
- 'release-*'
tags:
- 'v*'

jobs:
buildx:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- 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@v3
with:
images: docker.io/kubesphere/volume-initializer
tags: ${{ steps.prepare.outputs.version }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push Docker images
uses: docker/build-push-action@v2.4.0
with:
context: .
file: ./Dockerfile
tags: ${{ steps.meta.outputs.tags }}
push: true
load: false
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
2 changes: 1 addition & 1 deletion config/samples/mongo-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
spec:
containers:
- name: container-tle280
image: 'registry.cn-hangzhou.aliyuncs.com/stoneshiyunify/mongodb:4.2.4-debian-10-r0'
image: 'bitnami/mongodb:4.2.4-debian-10-r0'
ports:
- name: http-27017
containerPort: 27017
Expand Down
2 changes: 1 addition & 1 deletion deploy/webhook-deployment-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ spec:
spec:
containers:
- name: volume-initializer
image: registry.cn-hangzhou.aliyuncs.com/stoneshiyunify/volume-initializer:latest
image: kubesphere/volume-initializer:latest
imagePullPolicy: Always
args: ['--tls-cert-file=/etc/run/certs/tls.crt', '--tls-private-key-file=/etc/run/certs/tls.key']
ports:
Expand Down
2 changes: 1 addition & 1 deletion deploy/webhook-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ spec:
spec:
containers:
- name: volume-initializer
image: registry.cn-hangzhou.aliyuncs.com/stoneshiyunify/volume-initializer:latest
image: kubesphere/volume-initializer:latest
imagePullPolicy: Always
args: ['--tls-cert-file=/etc/run/certs/tls.crt', '--tls-private-key-file=/etc/run/certs/tls.key']
ports:
Expand Down

0 comments on commit e37583a

Please sign in to comment.