Skip to content

Merge pull request #119 from chouchongYHMing/i18n-tool-proposal #54

Merge pull request #119 from chouchongYHMing/i18n-tool-proposal

Merge pull request #119 from chouchongYHMing/i18n-tool-proposal #54

Workflow file for this run

name: Build Images
on:
push:
branches:
- main
- feature/*
jobs:
build-fronted:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@v4
with:
version: 8.15.6
- name: Build dashboard
run: |
echo "Start build"
pnpm --version
cd ui
pnpm install -w
pnpm run dashboard:build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
path: ui/apps/dashboard/dist
name: dashboard_artifact
build-and-push-web:
if: ${{ github.repository == 'karmada-io/dashboard' }}
runs-on: ubuntu-latest
needs: [ "build-fronted" ]
env:
IMAGE_NAME: karmada/karmada-dashboard-web
BINARY_NAME: karmada-dashboard-web
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Detect misc info
id: misc
run: |
echo "os=$(go env GOHOSTOS)" >> $GITHUB_OUTPUT
echo "arch=$(go env GOHOSTARCH)" >> $GITHUB_OUTPUT
echo "image_name=$IMAGE_NAME" >> $GITHUB_OUTPUT
echo "binary_name=$BINARY_NAME" >> $GITHUB_OUTPUT
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER_NAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build karmada-dashboard-web binary
run: make bin-karmada-dashboard-web
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: dashboard_artifact
path: _output/bin/${{ steps.misc.outputs.os }}/${{ steps.misc.outputs.arch }}/dist
- name: Display artifact
run: |
ls -al _output/bin
ls -al _output/bin/${{ steps.misc.outputs.os }}/${{ steps.misc.outputs.arch }}/dist
- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.misc.outputs.image_name }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
file: "cluster/images/build-web.Dockerfile"
context: "_output/bin/${{ steps.misc.outputs.os }}/${{ steps.misc.outputs.arch }}"
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: |
BINARY=${{ steps.misc.outputs.binary_name }}
BUILD_PLATFORMS=${{ steps.misc.outputs.os }}/${{ steps.misc.outputs.arch }}
build-and-push-api:
if: ${{ github.repository == 'karmada-io/dashboard' }}
runs-on: ubuntu-latest
env:
IMAGE_NAME: karmada/karmada-dashboard-api
BINARY_NAME: karmada-dashboard-api
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Detect misc info
id: misc
run: |
echo "os=$(go env GOHOSTOS)" >> $GITHUB_OUTPUT
echo "arch=$(go env GOHOSTARCH)" >> $GITHUB_OUTPUT
echo "image_name=$IMAGE_NAME" >> $GITHUB_OUTPUT
echo "binary_name=$BINARY_NAME" >> $GITHUB_OUTPUT
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER_NAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata for the Docker image
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.misc.outputs.image_name }}
- name: Build karmada-dashboard-api binary
run: make karmada-dashboard-api
- name: Build and push image
uses: docker/build-push-action@v6
with:
file: "cluster/images/Dockerfile"
context: "_output/bin/${{ steps.misc.outputs.os }}/${{ steps.misc.outputs.arch }}"
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: |
BINARY=${{ steps.misc.outputs.binary_name }}
BUILD_PLATFORMS=${{ steps.misc.outputs.os }}/${{ steps.misc.outputs.arch }}