1
- name : Build image manually
1
+ name : Build image
2
2
3
3
on :
4
+ push :
5
+ branches :
6
+ - main
4
7
workflow_dispatch :
5
8
inputs :
6
9
docker_image_tag_name :
7
10
type : string
8
11
description : Docker image tag name (Optional)
9
12
13
+ env :
14
+ ENGINE_IMAGE : ghcr.io/canner/wren-engine-saas
15
+ IBIS_IMAGE : ghcr.io/canner/wren-engine-saas-ibis
16
+
10
17
jobs :
11
18
prepare-tag :
12
19
runs-on : ubuntu-latest
@@ -15,14 +22,21 @@ jobs:
15
22
- name : Prepare tag name
16
23
id : prepare_tag
17
24
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
22
36
fi
23
- echo "tag_name=$tag_name " >> " $GITHUB_OUTPUT"
37
+ echo "tags=$(cat tags.txt) " >> $GITHUB_OUTPUT
24
38
outputs :
25
- tag_name : ${{ steps.prepare_tag.outputs.tag_name }}
39
+ tags : ${{ steps.prepare_tag.outputs.tags }}
26
40
build-image :
27
41
needs : prepare-tag
28
42
runs-on : ubuntu-latest
@@ -41,17 +55,14 @@ jobs:
41
55
id : meta
42
56
uses : docker/metadata-action@v5
43
57
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 }}
47
60
- name : Login to GitHub Container Registry
48
61
uses : docker/login-action@v3
49
62
with :
50
63
registry : ghcr.io
51
64
username : ${{ github.actor }}
52
65
password : ${{ secrets.GITHUB_TOKEN }}
53
- - name : Set up QEMU
54
- uses : docker/setup-qemu-action@v3
55
66
- name : Set up Docker Buildx
56
67
uses : docker/setup-buildx-action@v3
57
68
- name : Prepare
69
80
build-args : |
70
81
WREN_VERSION=${{ steps.prepare.outputs.WREN_VERSION }}
71
82
push : true
72
- build-ibis-amd64- image :
83
+ build-ibis-image :
73
84
needs : prepare-tag
74
85
runs-on : ubuntu-latest
75
86
steps :
@@ -78,17 +89,14 @@ jobs:
78
89
id : meta
79
90
uses : docker/metadata-action@v5
80
91
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 }}
84
94
- name : Login to GitHub Container Registry
85
95
uses : docker/login-action@v3
86
96
with :
87
97
registry : ghcr.io
88
98
username : ${{ github.actor }}
89
99
password : ${{ secrets.GITHUB_TOKEN }}
90
- - name : Set up QEMU
91
- uses : docker/setup-qemu-action@v3
92
100
- name : Set up Docker Buildx
93
101
uses : docker/setup-buildx-action@v3
94
102
- name : Build and push
0 commit comments