-
Notifications
You must be signed in to change notification settings - Fork 1
161 lines (156 loc) Β· 4.9 KB
/
build-client.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
name: Build client
on:
push:
branches:
- '*'
paths:
- .github/workflows/build-client.yml
- client/**
- server/constants.json
# Keep this uncommented until we're ready to start releasing client on a tag
# tags:
# - 'v*'
workflow_dispatch:
env:
TOMATO_VERSION: ${{ github.ref_type == 'tag' && github.ref_name || 'preview' }}
NODE_VERSION: 18
concurrency:
group: client-build-${github.ref_type}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
name: Build ${{ matrix.title }}
strategy:
matrix:
include:
-
title: macOS
os: macos-11
arch: universal
platform: darwin
out_path: "*.dmg"
filename_suffix: macos.dmg
-
title: Windows
os: windows-2022
arch: x64
platform: win32
out_path: squirrel.windows/x64/*.exe
filename_suffix: windows.exe
-
title: Linux (amd64)
os: ubuntu-22.04
arch: x64
platform: linux
out_path: deb/x64/*.deb
filename_suffix: linux_amd64.deb
-
title: Linux (arm64)
os: ubuntu-22.04
arch: arm64
platform: linux
out_path: deb/arm64/*.deb
filename_suffix: linux_arm64.deb
steps:
-
name: Checkout
uses: actions/checkout@v4
with: # For rev number in TOMATO_VERSION_SUFFIX
fetch-depth: 0
-
name: Set variables
shell: bash
run: |
echo "CLIENT_FILENAME=tomato-client-${{ env.TOMATO_VERSION }}-${{ matrix.filename_suffix }}" >> "$GITHUB_ENV"
if [ "$GITHUB_REF_TYPE" = tag ]; then
echo "TOMATO_VERSION_SUFFIX=" >> "$GITHUB_ENV"
else
echo "TOMATO_VERSION_SUFFIX=-r$(git rev-list --count HEAD).$(git rev-parse --short=8 HEAD)" >> "$GITHUB_ENV"
fi
-
name: Setup Node v18
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
-
# macOS: appears to fix https://github.com/electron/forge/issues/2807
name: Setup Python 3.11 (macOS)
uses: actions/setup-python@v4
if: matrix.platform == 'darwin'
with:
python-version: '3.11'
-
name: Build package
shell: bash
run: |
echo "Building Tomato for ${{ matrix.title }}"
cd client
if [ "${{ matrix.platform }}" = "win32" ]; then
npm config set script-shell $(which bash)
fi
npm clean-install
TOMATO_VERSION=${{ env.TOMATO_VERSION }}${{ env.TOMATO_VERSION_SUFFIX }} npm run build
npx electron-forge make --arch ${{ matrix.arch }} --platform ${{ matrix.platform }}
mkdir ../client-build-files
mv -v out/make/${{ matrix.out_path }} ../client-build-files/${{ env.CLIENT_FILENAME }}
if [ "${{ matrix.platform }}" = "linux" -a "${{ matrix.arch }}" = "x64" ]; then
mv -v out/make/*.AppImage ../client-build-files/${CLIENT_FILENAME%%.*}.AppImage
fi
-
name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: client-build-files
path: client-build-files
retention-days: 2
tag:
runs-on: ubuntu-22.04
name: Tag release
if: github.ref_type == 'tag' || github.ref_name == 'main'
needs: build
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: client-build-files
path: client-build-files
-
name: Remove old preview release
uses: dev-drprasad/[email protected]
if: github.ref_type != 'tag'
with:
delete_release: true
tag_name: preview-build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
name: Wait for old preview release deletion
shell: bash
if: github.ref_type != 'tag'
run: |
sleep 30s
-
name: Tag and upload preview release
uses: ncipollo/release-action@v1
if: github.ref_type != 'tag'
with:
artifacts: "./client-build-files/*"
name: 'Tomato Preview Build'
body: 'This development preview build may not be safe: use it at your own risk.'
tag: 'preview-build'
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
-
name: Tag and upload release
uses: ncipollo/release-action@v1
if: github.ref_type == 'tag'
with:
artifacts: "./client-build-files/*"
name: 'Tomato Release ${{ github.ref_name }}'
tag: ${{ github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}