-
Notifications
You must be signed in to change notification settings - Fork 20
273 lines (262 loc) · 8.08 KB
/
release.yml
File metadata and controls
273 lines (262 loc) · 8.08 KB
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
name: Release
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
jobs:
build_artifacts:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.3xx'
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'yarn'
cache-dependency-path: |
SQLSchemaCompare/yarn.lock
SQLSchemaCompare.UI/yarn.lock
- name: Restore dependencies
run: dotnet restore --locked-mode
- name: Build win-x64
run: dotnet build --no-restore SQLSchemaCompare.UI -r win-x64 -c Release
- name: Publish win-x64
run: dotnet publish --no-build --no-restore SQLSchemaCompare.UI -r win-x64 -c Release
- name: Upload win-x64 artifacts
uses: actions/upload-artifact@v7
with:
name: publish-win
path: .publish
if-no-files-found: 'error'
include-hidden-files: true
- name: Build linux-x64
run: dotnet build --no-restore SQLSchemaCompare.UI -r linux-x64 -c Release
- name: Publish linux-x64
run: dotnet publish --no-build --no-restore SQLSchemaCompare.UI -r linux-x64 -c Release
- name: Upload linux-x64 artifacts
uses: actions/upload-artifact@v7
with:
name: publish-linux
path: .publish
if-no-files-found: 'error'
include-hidden-files: true
- name: Build osx-x64
run: dotnet build --no-restore SQLSchemaCompare.UI -r osx-x64 -c Release
- name: Publish osx-x64
run: dotnet publish --no-build --no-restore SQLSchemaCompare.UI -r osx-x64 -c Release
- name: Upload osx-x64 artifacts
uses: actions/upload-artifact@v7
with:
name: publish-osx-x64
path: .publish
if-no-files-found: 'error'
include-hidden-files: true
- name: Build osx-arm64
run: dotnet build --no-restore SQLSchemaCompare.UI -r osx-arm64 -c Release
- name: Publish osx-arm64
run: dotnet publish --no-build --no-restore SQLSchemaCompare.UI -r osx-arm64 -c Release
- name: Upload osx-arm64 artifacts
uses: actions/upload-artifact@v7
with:
name: publish-osx-arm64
path: .publish
if-no-files-found: 'error'
include-hidden-files: true
installer_win_x64:
runs-on: windows-latest
needs: build_artifacts
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'yarn'
cache-dependency-path: |
SQLSchemaCompare/yarn.lock
SQLSchemaCompare.UI/yarn.lock
- name: Download publish-win artifact
uses: actions/download-artifact@v8
with:
name: publish-win
path: .publish
- name: Create installer
run: yarn dist-win-x64
working-directory: SQLSchemaCompare
- name: Upload installer to release
if: github.event_name == 'push'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: installer/*.exe
tag: ${{ github.ref }}
- name: Upload installer to artifacts
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v7
with:
name: installer-win-x64
path: installer/*.exe
retention-days: 7
if-no-files-found: 'error'
installer_linux_x64:
runs-on: ubuntu-latest
needs: build_artifacts
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'yarn'
cache-dependency-path: |
SQLSchemaCompare/yarn.lock
SQLSchemaCompare.UI/yarn.lock
- name: Download publish-linux artifact
uses: actions/download-artifact@v8
with:
name: publish-linux
path: .publish
- name: Prepare artifacts
run: |
chmod +x .publish/TiCodeX.SQLSchemaCompare.UI
chmod +x .publish/TiCodeX.SQLSchemaCompare.CLI
- name: Create installer
run: yarn dist-linux-x64
working-directory: SQLSchemaCompare
- name: Upload installer to release
if: github.event_name == 'push'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: installer/*.{deb,rpm,tar.gz}
tag: ${{ github.ref }}
- name: Upload installer to artifacts
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v7
with:
name: installer-linux-x64
path: |
installer/*.deb
installer/*.rpm
installer/*.tar.gz
retention-days: 7
if-no-files-found: 'error'
installer_osx:
runs-on: macos-latest
needs: build_artifacts
strategy:
matrix:
arch: [x64, arm64]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '22'
cache: 'yarn'
cache-dependency-path: |
SQLSchemaCompare/yarn.lock
SQLSchemaCompare.UI/yarn.lock
- name: Download publish-osx-${{ matrix.arch }} artifact
uses: actions/download-artifact@v8
with:
name: publish-osx-${{ matrix.arch }}
path: .publish
- name: Prepare artifacts
run: |
chmod +x .publish/TiCodeX.SQLSchemaCompare.UI
chmod +x .publish/TiCodeX.SQLSchemaCompare.CLI
- name: Create installer
run: yarn dist-osx
working-directory: SQLSchemaCompare
env:
ARCH_SUFFIX: ${{ matrix.arch }}
- name: Upload installer to release
if: github.event_name == 'push'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file_glob: true
file: installer/*.dmg
tag: ${{ github.ref }}
- name: Upload installer to artifacts
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v7
with:
name: installer-osx-${{ matrix.arch }}
path: installer/*.dmg
retention-days: 7
if-no-files-found: 'error'
clean_artifacts:
runs-on: windows-latest
if: always()
needs: [installer_win_x64, installer_linux_x64, installer_osx]
steps:
- uses: geekyeggo/delete-artifact@v5
with:
name: |
publish-win
publish-linux
publish-osx-x64
publish-osx-arm64
docker_image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
with:
images: |
${{ vars.DOCKERHUB_USERNAME }}/sqlschemacompare
ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern={{version}}
- name: Login to Docker Hub
if: github.event_name == 'push'
uses: docker/login-action@v4
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
if: github.event_name == 'push'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
file: ./SQLSchemaCompare.CLI/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: ${{ github.event_name == 'push' }}
outputs: ${{ github.event_name == 'workflow_dispatch' && 'type=docker,dest=/tmp/docker.tar' || '' }}
- name: Upload docker to artifacts
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v7
with:
name: docker
path: /tmp/docker.tar
retention-days: 7
if-no-files-found: 'error'