Skip to content

chore: update github action #477

chore: update github action

chore: update github action #477

name: Build all in one image
on:
push:
branches:
- main
release:
types: [published]
env:
ILLA_MUI_LICENSE: ${{ secrets.ILLA_MUI_LICENSE }}
ILLA_BASE_PATH: /build
jobs:
build:
name: Build docker image
runs-on: ubuntu-latest
steps:
- name: Set build args
run: |
if [ "${{ github.event_name }}" = "release" ]; then
TAG=${{ github.event.release.tag_name }}
VERSION=v${TAG#illa-builder@}
echo "IMAGE_TAG=${VERSION}" >> $GITHUB_ENV
echo "BUILD_SBE_BRANCH=main" >> $GITHUB_ENV
echo "BUILD_BE_BRANCH=main" >> $GITHUB_ENV
echo "BUILD_FE_BRANCH=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
else
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
echo "BUILD_SBE_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
echo "BUILD_BE_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
echo "BUILD_FE_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
with:
repository: illacloud/build-all-in-one-image
path: build-all-in-one-image
- uses: actions/checkout@v4
with:
repository: illacloud/illa-builder
path: illa-builder
submodules: true
- uses: actions/setup-node@v3
with:
node-version: 18.12.1
- uses: pnpm/action-setup@v2
with:
version: 8.7.0
- name: Build website
run: |
ls
cd illa-builder
pnpm install --frozen-lockfile
echo "Building for $GITHUB_REF_NAME branch,ILLA APP ENV is $ILLA_APP_ENV"
pnpm build-self
cp ./apps/builder/dist ../build-all-in-one-image/builder -r
cp ./apps/cloud/dist ../build-all-in-one-image/cloud -r
cd ..
- name: ls build-all-in-one
run: |
ls build-all-in-one-image
- name: ls cloud
run: |
ls build-all-in-one-image/cloud
- name: ls builder
run: |
ls build-all-in-one-image/builder
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_PWD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./build-all-in-one-image
platforms: linux/amd64,linux/arm64
push: true
tags: |
illasoft/illa-builder:${{ env.IMAGE_TAG }}
${{ github.event_name == 'release' && startsWith(github.event.release.tag_name, 'illa-builder@') && 'illasoft/illa-builder:latest' || '' }}
build-args: |
FE=${{ env.BUILD_FE_BRANCH }}
BE=${{ env.BUILD_BE_BRANCH }}
SBE=${{ env.BUILD_SBE_BRANCH }}