-
Notifications
You must be signed in to change notification settings - Fork 1.1k
103 lines (88 loc) · 3.03 KB
/
build-all-in-one-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Build all in one image
on:
push:
branches:
- main
- develop
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 "ILLA_BASE_PATH=/builder" >> $GITHUB_ENV
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 }}