-
Notifications
You must be signed in to change notification settings - Fork 23
204 lines (181 loc) · 6.5 KB
/
build-docker-images.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: ci
on:
workflow_dispatch:
push:
env:
DOCKER_IMAGE_NAME: voltrondata/sqlflite
jobs:
build-project-macos:
name: Build Project - MacOS
strategy:
matrix:
include:
- platform: amd64
os: macos
runner: macos-13
- platform: arm64
os: macos
runner: macos-13-xlarge
runs-on: ${{ matrix.runner }}
env:
zip_file_name: sqlflite_cli_${{ matrix.os }}_${{ matrix.platform }}.zip
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install build requirements
env:
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
run: |
brew install automake boost gflags
- name: Configure Project
uses: threeal/[email protected]
with:
generator: Ninja
run-build: true
- name: Sign and notarize the server release build
uses: prmoore77/action-macos-sign-notarize@b0f525e0d98a47b0884558b786f21453889a04d7
with:
certificate: ${{ secrets.APPLE_CERTIFICATE }}
certificate-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
username: ${{ secrets.APPLE_ID_USERNAME }}
password: ${{ secrets.APPLE_ID_PASSWORD }}
apple-team-id: ${{ secrets.APPLE_TEAM_ID }}
app-path: build/sqlflite_server
entitlements-path: macos/entitlements.plist
- name: Sign and notarize the server release build
uses: prmoore77/action-macos-sign-notarize@b0f525e0d98a47b0884558b786f21453889a04d7
with:
certificate: ${{ secrets.APPLE_CERTIFICATE }}
certificate-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
username: ${{ secrets.APPLE_ID_USERNAME }}
password: ${{ secrets.APPLE_ID_PASSWORD }}
apple-team-id: ${{ secrets.APPLE_TEAM_ID }}
app-path: build/sqlflite_client
- name: Zip artifacts
run: |
mv build/sqlflite_server build/sqlflite_client .
zip -j ${{ env.zip_file_name }} sqlflite_server sqlflite_client
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.zip_file_name }}
path: |
${{ env.zip_file_name }}
build-project-linux:
name: Build Project - Linux
strategy:
matrix:
include:
- platform: amd64
os: linux
runner: buildjet-8vcpu-ubuntu-2204
- platform: arm64
os: linux
runner: buildjet-8vcpu-ubuntu-2204-arm
runs-on: ${{ matrix.runner }}
env:
zip_file_name: sqlflite_cli_${{ matrix.os }}_${{ matrix.platform }}.zip
steps:
- name: Checkout
uses: actions/[email protected]
- name: Install build requirements
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
ninja-build \
automake \
cmake \
gcc \
git \
libboost-all-dev \
libgflags-dev
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/*
- name: Configure Project
uses: threeal/[email protected]
with:
generator: Ninja
run-build: true
- name: Zip artifacts
run: |
mv build/sqlflite_server build/sqlflite_client .
zip -j ${{ env.zip_file_name }} sqlflite_server sqlflite_client
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.zip_file_name }}
path: |
${{ env.zip_file_name }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push full Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/${{ matrix.platform }}
file: Dockerfile.ci
push: ${{ startsWith(github.ref, 'refs/tags/') }}
tags: |
${{ env.DOCKER_IMAGE_NAME }}:latest-${{ matrix.platform }}
${{ env.DOCKER_IMAGE_NAME }}:${{ github.ref_name }}-${{ matrix.platform }}
no-cache: true
provenance: false
- name: Build and push slim Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/${{ matrix.platform }}
file: Dockerfile-slim.ci
push: ${{ startsWith(github.ref, 'refs/tags/') }}
tags: |
${{ env.DOCKER_IMAGE_NAME }}:latest-${{ matrix.platform }}-slim
${{ env.DOCKER_IMAGE_NAME }}:${{ github.ref_name }}-${{ matrix.platform }}-slim
no-cache: true
provenance: false
create-release:
name: Create a release
if: startsWith(github.ref, 'refs/tags/')
needs: [build-project-macos, build-project-linux]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: sqlflite_cli_*.zip
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/sqlflite_cli_*.zip
LICENSE
update-image-manifest:
name: Update DockerHub image manifest to include all built platforms
if: startsWith(github.ref, 'refs/tags/')
needs: build-project-linux
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Create and push full manifest images
uses: Noelware/docker-manifest-action@master # or use a pinned version in the Releases tab
with:
inputs: ${{ env.DOCKER_IMAGE_NAME }}:latest,${{ env.DOCKER_IMAGE_NAME }}:${{ github.ref_name }}
images: ${{ env.DOCKER_IMAGE_NAME }}:latest-amd64,${{ env.DOCKER_IMAGE_NAME }}:latest-arm64
push: true
- name: Create and push slim manifest images
uses: Noelware/docker-manifest-action@master # or use a pinned version in the Releases tab
with:
inputs: ${{ env.DOCKER_IMAGE_NAME }}:latest-slim,${{ env.DOCKER_IMAGE_NAME }}:${{ github.ref_name }}-slim
images: ${{ env.DOCKER_IMAGE_NAME }}:latest-amd64-slim,${{ env.DOCKER_IMAGE_NAME }}:latest-arm64-slim
push: true