forked from frain-dev/convoy
-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (125 loc) · 3.81 KB
/
build-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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Build and Push Docker Images
on:
workflow_dispatch:
inputs:
name:
description: "Manual workflow name"
required: true
push:
tags:
# Release binary for every tag.
- v*
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
IMAGE_NAME: getconvoy/convoy
RELEASE_VERSION: ${{ github.ref_name }}
jobs:
build_ui:
name: Build UI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Artifact
run: "make ui_install type=ce"
- name: Archive Build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-without-markdown
path: |
web/ui/dashboard/dist
!web/ui/dashboard/dist/**/*.md
build-and-push-arch:
runs-on: ubuntu-latest
needs: [build_ui]
strategy:
matrix:
include:
- arch: amd64
platform: linux/amd64
dockerfile: release.Dockerfile
- arch: arm64
platform: linux/arm64
dockerfile: release.Dockerfile
steps:
- uses: actions/checkout@v4
- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: dist-without-markdown
path: api/ui/build
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Check out code
uses: actions/checkout@v4
- name: Get and verify dependencies
run: go mod tidy && go mod download && go mod verify
- name: Go vet
run: go vet ./...
- name: Build app to make sure there are zero issues
run: go build -o convoy ./cmd
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_TOKEN }}
- name: Build and push arch specific images
uses: docker/build-push-action@v2
with:
context: .
file: ${{ matrix.dockerfile }}
platforms: ${{ matrix.platform }}
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}-${{ matrix.arch }}
build-args: |
ARCH=${{ matrix.arch }}
build-and-push-default:
runs-on: ubuntu-latest
needs: [build_ui]
steps:
- uses: actions/checkout@v4
- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: dist-without-markdown
path: api/ui/build
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21
- name: Check out code
uses: actions/checkout@v4
- name: Get and verify dependencies
run: go mod tidy && go mod download && go mod verify
- name: Go vet
run: go vet ./...
- name: Build app to make sure there are zero issues
run: go build -o convoy ./cmd
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USERNAME }}
password: ${{ env.DOCKER_HUB_TOKEN }}
- name: Build and push default image
uses: docker/build-push-action@v2
with:
context: .
file: release.Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
${{ env.IMAGE_NAME }}:latest