-
-
Notifications
You must be signed in to change notification settings - Fork 18
238 lines (217 loc) · 8.94 KB
/
build.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
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
name: Build
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
createrelease:
name: Create Release
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Create Release
uses: ncipollo/release-action@v1
with:
token: "${{ secrets.GITHUB_TOKEN }}"
name: Release ${{ github.ref_name }}
build-wheel:
name: Build wheel
needs: createrelease
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Build SDist and wheel
run: pipx run build
- uses: actions/upload-artifact@v3
with:
path: dist/*
build-binary:
name: Build packages
needs: createrelease
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-2019
TARGET: windows
CMD_BUILD: |
python compile.py
move sticker-convert.dist sticker-convert
Compress-Archive -Path sticker-convert -DestinationPath sticker-convert-windows-x86_64.zip
dotnet tool install --global wix
wix extension add WixToolset.UI.wixext
python .\msicreator\createmsi.py msicreator.json
move *.msi sticker-convert-windows-x86_64.msi
OUT_FILE_NAME: |
./sticker-convert-windows-x86_64.zip
./sticker-convert-windows-x86_64.msi
- os: macos-11
TARGET: macos-x86_64
CMD_BUILD: |
SC_COMPILE_ARCH=x86_64 python ./compile.py
cp ./scripts/hold_control_and_click_open_me_first.command ./
zip -r9 sticker-convert-macos-x86_64.zip sticker-convert.app hold_control_and_click_open_me_first.command
OUT_FILE_NAME: ./sticker-convert-macos-x86_64.zip
- os: macos-11
TARGET: macos-arm64
CMD_BUILD: |
SC_COMPILE_ARCH=arm64 python ./compile.py
cp ./scripts/hold_control_and_click_open_me_first.command ./
zip -r9 sticker-convert-macos-arm64.zip sticker-convert.app hold_control_and_click_open_me_first.command
OUT_FILE_NAME: ./sticker-convert-macos-arm64.zip
- os: ubuntu-20.04
TARGET: linux-x86_64
CMD_BUILD: |
sudo apt install -y libpng-dev libxft-dev libfontconfig1-dev libfreetype6-dev
wget -O appimage-builder https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage
wget -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
chmod +x ./appimage-builder
chmod +x ./appimagetool
# Creating appimage directly with appimage-builder result in xz compression
# That would be not possible to be verified by https://appimage.github.io/apps/
# Due to https://github.com/AppImage/appimage.github.io/blob/master/code/worker.sh
# runtime-fuse2-x86_64 unable to handle xz compression
./appimage-builder --skip-appimage --recipe AppImageBuilder-x86_64.yml
# Add .desktop comment
sed -i 's/Comment=/Comment=Convert (animated) stickers between WhatsApp, Telegram, Signal, Line, Kakao, iMessage/g' ./AppDir/*.desktop
# Add appdata.xml
mkdir -p AppDir/usr/share/metainfo
cp ./sticker-convert.appdata.xml AppDir/usr/share/metainfo
# Bundling into appimage
ARCH=x86_64 ./appimagetool ./AppDir
chmod +x sticker-convert-x86_64.AppImage
OUT_FILE_NAME: ./sticker-convert-x86_64.AppImage
- os: ubuntu-20.04
TARGET: linux-arm64
CMD_BUILD: |
sudo apt install -y libpng-dev libxft-dev libfontconfig1-dev libfreetype6-dev
wget -O appimage-builder https://github.com/AppImageCrafters/appimage-builder/releases/download/v1.1.0/appimage-builder-1.1.0-x86_64.AppImage
wget -O appimagetool https://github.com/AppImage/AppImageKit/releases/download/13/appimagetool-x86_64.AppImage
wget https://github.com/AppImage/AppImageKit/releases/download/13/runtime-aarch64
chmod +x ./appimage-builder
chmod +x ./appimagetool
# Creating appimage directly with appimage-builder result in xz compression
# That would be not possible to be verified by https://appimage.github.io/apps/
# Due to https://github.com/AppImage/appimage.github.io/blob/master/code/worker.sh
# runtime-fuse2-x86_64 unable to handle xz compression
./appimage-builder --skip-appimage --recipe AppImageBuilder-arm64.yml
# Add .desktop comment
sed -i 's/Comment=/Comment=Convert (animated) stickers between WhatsApp, Telegram, Signal, Line, Kakao, iMessage/g' ./AppDir/*.desktop
# Add appdata.xml
mkdir -p AppDir/usr/share/metainfo
cp ./sticker-convert.appdata.xml AppDir/usr/share/metainfo
# Bundling into appimage
ARCH=arm_aarch64 ./appimagetool --runtime-file ./runtime-aarch64 ./AppDir
chmod +x sticker-convert-aarch64.AppImage
OUT_FILE_NAME: ./sticker-convert-aarch64.AppImage
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
allow-prereleases: true
- name: Build for ${{matrix.TARGET}}
run: ${{matrix.CMD_BUILD}}
- name: Get release
id: get_release
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload Release Asset
id: upload-release-asset
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: ${{ matrix.OUT_FILE_NAME }}
build-docker:
name: Build Docker image and push
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker (min-cli)
id: meta_min_cli
uses: docker/metadata-action@v4
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
flavor: |
suffix=-min-cli,onlatest=true
- name: Extract metadata (tags, labels) for Docker (min-gui)
id: meta_min_gui
uses: docker/metadata-action@v4
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
flavor: |
suffix=-min-gui,onlatest=true
- name: Extract metadata (tags, labels) for Docker (full)
id: meta_full
uses: docker/metadata-action@v4
with:
images: |
${{ github.repository }}
ghcr.io/${{ github.repository }}
- name: Build and push Docker image (min-cli)
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta_min_cli.outputs.tags }}
labels: ${{ steps.meta_min_cli.outputs.labels }}
target: min-cli
- name: Build and push Docker image (min-gui)
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta_min_gui.outputs.tags }}
labels: ${{ steps.meta_min_gui.outputs.labels }}
target: min-gui
- name: Build and push Docker image (full)
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta_full.outputs.tags }}
labels: ${{ steps.meta_full.outputs.labels }}
target: full
upload-pypi:
name: Upload to pypi
needs: [build-wheel, build-binary]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: artifact
path: dist
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}