Skip to content

Commit fa5cb99

Browse files
grieve54706goldmedal
authored andcommitted
ci(image): adjust build flow (#893)
1 parent 9b0f092 commit fa5cb99

File tree

3 files changed

+32
-115
lines changed

3 files changed

+32
-115
lines changed

.github/workflows/build-dev-image.yml

-91
This file was deleted.

.github/workflows/build-image.yml

+26-18
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
name: Build image manually
1+
name: Build image
22

33
on:
4+
push:
5+
branches:
6+
- main
47
workflow_dispatch:
58
inputs:
69
docker_image_tag_name:
710
type: string
811
description: Docker image tag name (Optional)
912

13+
env:
14+
ENGINE_IMAGE: ghcr.io/canner/wren-engine-saas
15+
IBIS_IMAGE: ghcr.io/canner/wren-engine-saas-ibis
16+
1017
jobs:
1118
prepare-tag:
1219
runs-on: ubuntu-latest
@@ -15,14 +22,21 @@ jobs:
1522
- name: Prepare tag name
1623
id: prepare_tag
1724
run: |
18-
if [ -n "${{ github.event.inputs.docker_image_tag_name }}" ]; then
19-
tag_name=${{ github.event.inputs.docker_image_tag_name }}
20-
else
21-
tag_name=$(echo ${{ github.ref_name }} | sed 's/[^a-zA-Z0-9]/-/g')-$(git log -1 --pretty=%h)
25+
if [ "${{ github.event_name }}" = "push" ]; then
26+
echo "type=sha" > tags.txt
27+
echo "type=raw,value=nightly" > tags.txt
28+
fi
29+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
30+
if [ -n "${{ github.event.inputs.docker_image_tag_name }}" ]; then
31+
tag_name=${{ github.event.inputs.docker_image_tag_name }}
32+
else
33+
tag_name=$(echo ${{ github.ref_name }} | sed 's/[^a-zA-Z0-9]/-/g')-$(git log -1 --pretty=%h)
34+
fi
35+
echo "type=raw,value=$tag_name" > tags.txt
2236
fi
23-
echo "tag_name=$tag_name" >> "$GITHUB_OUTPUT"
37+
echo "tags=$(cat tags.txt)" >> $GITHUB_OUTPUT
2438
outputs:
25-
tag_name: ${{ steps.prepare_tag.outputs.tag_name }}
39+
tags: ${{ steps.prepare_tag.outputs.tags }}
2640
build-image:
2741
needs: prepare-tag
2842
runs-on: ubuntu-latest
@@ -41,17 +55,14 @@ jobs:
4155
id: meta
4256
uses: docker/metadata-action@v5
4357
with:
44-
images: ghcr.io/canner/wren-engine-saas
45-
tags: |
46-
type=raw,value=${{ needs.prepare-tag.outputs.tag_name }}
58+
images: ${{ env.ENGINE_IMAGE }}
59+
tags: ${{ needs.prepare-tag.outputs.tags }}
4760
- name: Login to GitHub Container Registry
4861
uses: docker/login-action@v3
4962
with:
5063
registry: ghcr.io
5164
username: ${{ github.actor }}
5265
password: ${{ secrets.GITHUB_TOKEN }}
53-
- name: Set up QEMU
54-
uses: docker/setup-qemu-action@v3
5566
- name: Set up Docker Buildx
5667
uses: docker/setup-buildx-action@v3
5768
- name: Prepare
@@ -69,7 +80,7 @@ jobs:
6980
build-args: |
7081
WREN_VERSION=${{ steps.prepare.outputs.WREN_VERSION }}
7182
push: true
72-
build-ibis-amd64-image:
83+
build-ibis-image:
7384
needs: prepare-tag
7485
runs-on: ubuntu-latest
7586
steps:
@@ -78,17 +89,14 @@ jobs:
7889
id: meta
7990
uses: docker/metadata-action@v5
8091
with:
81-
images: ghcr.io/canner/wren-engine-saas-ibis
82-
tags: |
83-
type=raw,value=${{ needs.prepare-tag.outputs.tag_name }}
92+
images: ${{ env.IBIS_IMAGE }}
93+
tags: ${{ needs.prepare-tag.outputs.tags }}
8494
- name: Login to GitHub Container Registry
8595
uses: docker/login-action@v3
8696
with:
8797
registry: ghcr.io
8898
username: ${{ github.actor }}
8999
password: ${{ secrets.GITHUB_TOKEN }}
90-
- name: Set up QEMU
91-
uses: docker/setup-qemu-action@v3
92100
- name: Set up Docker Buildx
93101
uses: docker/setup-buildx-action@v3
94102
- name: Build and push

.github/workflows/release-please.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ permissions:
1010

1111
name: release-please
1212

13+
env:
14+
ENGINE_IMAGE: ghcr.io/canner/wren-engine-saas
15+
IBIS_IMAGE: ghcr.io/canner/wren-engine-saas-ibis
16+
1317
jobs:
1418
release-please:
1519
runs-on: ubuntu-latest
@@ -47,7 +51,7 @@ jobs:
4751
id: meta
4852
uses: docker/metadata-action@v5
4953
with:
50-
images: ghcr.io/canner/wren-engine-saas
54+
images: ${{ env.ENGINE_IMAGE }}
5155
tags: |
5256
type=raw,value=${{ needs.release-please.outputs.tag_name }}
5357
type=raw,value=latest
@@ -57,8 +61,6 @@ jobs:
5761
registry: ghcr.io
5862
username: ${{ github.actor }}
5963
password: ${{ secrets.GITHUB_TOKEN }}
60-
- name: Set up QEMU
61-
uses: docker/setup-qemu-action@v3
6264
- name: Set up Docker Buildx
6365
uses: docker/setup-buildx-action@v3
6466
- name: Prepare
@@ -86,7 +88,7 @@ jobs:
8688
id: meta
8789
uses: docker/metadata-action@v5
8890
with:
89-
images: ghcr.io/canner/wren-engine-saas-ibis
91+
images: ${{ env.IBIS_IMAGE }}
9092
tags: |
9193
type=raw,value=${{ needs.release-please.outputs.tag_name }}
9294
type=raw,value=latest
@@ -96,8 +98,6 @@ jobs:
9698
registry: ghcr.io
9799
username: ${{ github.actor }}
98100
password: ${{ secrets.GITHUB_TOKEN }}
99-
- name: Set up QEMU
100-
uses: docker/setup-qemu-action@v3
101101
- name: Set up Docker Buildx
102102
uses: docker/setup-buildx-action@v3
103103
- name: Build and push

0 commit comments

Comments
 (0)