|
1 |
| -name: Build lowcoder dev image |
| 1 | +name: Build lowcoder docker images |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - branches: dev |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + imageTag: |
| 7 | + type: choice |
| 8 | + description: 'Choose a tag for built docker image(s)' |
| 9 | + required: true |
| 10 | + default: 'latest' |
| 11 | + options: |
| 12 | + - latest |
| 13 | + - test |
| 14 | + buildAllinone: |
| 15 | + type: boolean |
| 16 | + description: 'Build the All-In-One image' |
| 17 | + buildFrontend: |
| 18 | + type: boolean |
| 19 | + description: 'Build the Frontend image' |
| 20 | + buildNodeService: |
| 21 | + type: boolean |
| 22 | + description: 'Build the Node service image' |
| 23 | + buildApiService: |
| 24 | + type: boolean |
| 25 | + description: 'Build the API service image' |
6 | 26 |
|
7 | 27 | jobs:
|
8 | 28 | build:
|
9 | 29 | runs-on: ubuntu-latest
|
10 | 30 | steps:
|
11 |
| - - name: Checkout lowcoder from 'dev' branch |
12 |
| - uses: actions/checkout@v4 |
13 |
| - with: |
14 |
| - ref: dev |
15 |
| - - name: Get commit short SHA |
16 |
| - run: echo "SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV |
17 |
| - - name: Log into Docker Hub |
18 |
| - uses: docker/login-action@v3 |
19 |
| - with: |
20 |
| - username: ${{ secrets.DOCKER_LOGIN }} |
21 |
| - password: ${{ secrets.DOCKER_PASSWORD }} |
22 |
| - - name: Setup Docker Buildx with cloud driver |
23 |
| - uses: docker/setup-buildx-action@v3 |
24 |
| - with: |
25 |
| - version: "lab:latest" |
26 |
| - driver: cloud |
27 |
| - endpoint: "lowcoderorg/lowcoder-cloud-builder" |
28 |
| - - name: Build and push the all-in-one image |
29 |
| - uses: docker/build-push-action@v6 |
30 |
| - env: |
31 |
| - NODE_ENV: production |
32 |
| - with: |
33 |
| - file: ./deploy/docker/Dockerfile |
34 |
| - build-args: | |
35 |
| - REACT_APP_ENV=production |
36 |
| - REACT_APP_COMMIT_ID="dev #${SHORT_SHA}" |
37 |
| - platforms: | |
38 |
| - linux/amd64 |
39 |
| - linux/arm64 |
40 |
| - push: true |
41 |
| - tags: lowcoderorg/lowcoder-ce:dev |
| 31 | + - name: Set environment variables |
| 32 | + shell: bash |
| 33 | + run: | |
| 34 | + # Get the short SHA of last commit |
| 35 | + echo "SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> "${GITHUB_ENV}" |
| 36 | + # Get branch name - we don't use github.ref_head_name since we don't build on PRs |
| 37 | + echo "BRANCH_NAME=${{ github.ref_name }}" >> "${GITHUB_ENV}" |
| 38 | + # Set docker image tag |
| 39 | + echo "IMAGE_TAG=${{ inputs.imageTag || github.ref_name }}" >> "${GITHUB_ENV}" |
| 40 | + # Control which images to build |
| 41 | + echo "BUILD_ALLINONE=${{ inputs.buildAllinone || true }}" >> "${GITHUB_ENV}" |
| 42 | + echo "BUILD_FRONTEND=${{ inputs.buildFrontend || true }}" >> "${GITHUB_ENV}" |
| 43 | + echo "BUILD_NODESERVICE=${{ inputs.buildNodeService || true }}" >> "${GITHUB_ENV}" |
| 44 | + echo "BUILD_APISERVICE=${{ inputs.buildApiService || true }}" >> "${GITHUB_ENV}" |
42 | 45 |
|
0 commit comments