-
Notifications
You must be signed in to change notification settings - Fork 1
212 lines (202 loc) · 5.88 KB
/
ci.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
205
206
207
208
209
210
211
212
name: Build, Test and Release
on:
push:
branches:
- master
tags-ignore:
- '**'
paths-ignore:
- '**/*.md'
- LICENSE
pull_request:
jobs:
linux:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.bump.outputs.bumped }}
changed-files: ${{ steps.bump.outputs.changed-files }}
new-version: ${{ steps.bump.outputs.new-version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: prantlf/bump-version-action@v2
if: github.ref_name == 'master'
id: bump
with:
bump-files: cmd/ovai/main.go
- uses: prantlf/shelve-changes-action@v2
- run: make RELEASE=1
- uses: prantlf/shelve-output-action@v3
if: ${{ steps.bump.outputs.bumped == 'true' }}
with:
name: ovai
linux-arm:
if: ${{ github.ref_name == 'master' && needs.linux.outputs.changed == 'true' }}
needs:
- linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: prantlf/unshelve-changes-action@v2
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- run: GOOS=linux GOARCH=arm64 make build RELEASE=1
- uses: prantlf/shelve-output-action@v3
with:
name: ovai
arch: arm64
macos:
if: ${{ github.ref_name == 'master' && needs.linux.outputs.changed == 'true' }}
needs:
- linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: prantlf/unshelve-changes-action@v2
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- run: GOOS=darwin GOARCH=amd64 make build RELEASE=1
- uses: prantlf/shelve-output-action@v3
with:
name: ovai
os: macos
macos-arm:
if: ${{ github.ref_name == 'master' && needs.linux.outputs.changed == 'true' }}
needs:
- linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: prantlf/unshelve-changes-action@v2
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- run: GOOS=darwin GOARCH=arm64 make build RELEASE=1
- uses: prantlf/shelve-output-action@v3
with:
name: ovai
os: macos
arch: arm64
windows:
if: ${{ github.ref_name == 'master' && needs.linux.outputs.changed == 'true' }}
needs:
- linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: prantlf/unshelve-changes-action@v2
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- run: |
GOOS=windows GOARCH=amd64 make build RELEASE=1
mv ovai ovai.exe
- uses: prantlf/shelve-output-action@v3
with:
name: ovai
os: windows
windows-arm:
if: ${{ github.ref_name == 'master' && needs.linux.outputs.changed == 'true' }}
needs:
- linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: prantlf/unshelve-changes-action@v2
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- run: |
GOOS=windows GOARCH=arm64 make build RELEASE=1
mv ovai ovai.exe
- uses: prantlf/shelve-output-action@v3
with:
name: ovai
os: windows
arch: arm64
docker:
needs:
- linux
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: prantlf/unshelve-changes-action@v2
if: ${{ needs.linux.outputs.changed == 'true' }}
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: hadolint/[email protected]
- uses: docker/build-push-action@v5
with:
push: false
platforms: linux/amd64,linux/arm64
release:
if: ${{ github.ref_name == 'master' && needs.linux.outputs.changed == 'true' }}
needs:
- linux
- linux-arm
- macos
- macos-arm
- windows
- windows-arm
- docker
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: prantlf/unshelve-changes-action@v2
with:
files: ${{ needs.linux.outputs.changed-files }}
discard-shelf: false
- uses: prantlf/unshelve-output-action@v6
with:
name: ovai
- uses: prantlf/finish-release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
docker-publish:
if: ${{ github.ref_name == 'master' && needs.linux.outputs.changed == 'true' }}
needs:
- linux
- release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: prantlf/unshelve-changes-action@v2
with:
files: ${{ needs.linux.outputs.changed-files }}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/metadata-action@v5
id: meta
with:
images: |
ghcr.io/prantlf/ovai
prantlf/ovai
tags: |
type=semver,pattern={{version}},value=v${{ needs.linux.outputs.new-version }}
type=semver,pattern={{major}}.{{minor}},value=v${{ needs.linux.outputs.new-version }}
type=semver,pattern={{major}},value=v${{ needs.linux.outputs.new-version }}
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64