-
-
Notifications
You must be signed in to change notification settings - Fork 29
259 lines (216 loc) · 7.29 KB
/
Copy pathrelease.yaml
File metadata and controls
259 lines (216 loc) · 7.29 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
name: Release
on:
workflow_dispatch:
push:
branches: [main]
tags:
- "*.*.*"
pull_request:
branches: [main]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
# Add permissions needed for creating releases
permissions:
contents: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
version: ${{ steps.get-version.outputs.version }}
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
environment-file: conda/release.yaml
channels: conda-forge,nodefaults
activate-environment: makim
auto-update-conda: true
conda-solver: libmamba
python-version: "3.11"
- name: Install deps
run: |
poetry config virtualenvs.create false
poetry install
- name: Run semantic release (for tests)
if: ${{ github.event_name != 'workflow_dispatch' }}
run: makim --verbose release.dry
- name: Run semantic release
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
poetry config pypi-token.pypi ${PYPI_TOKEN}
makim --verbose release.ci
- name: Get the current poetry version
id: get-version
run: |
poetry_version=$(poetry version --short)
echo "version=$poetry_version" >> $GITHUB_OUTPUT
echo "Project version: $poetry_version"
- name: Generate documentation with changes from semantic-release
if: ${{ github.event_name == 'workflow_dispatch' }}
run: makim --verbose docs.build
- name: GitHub Pages action
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: peaceiris/actions-gh-pages@v3.5.9
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/
- name: Setup tmate session
if: "${{ failure() && (contains(github.event.pull_request.labels.*.name, 'ci:enable-debugging')) }}"
uses: mxschmitt/action-tmate@v3
build:
needs: release
runs-on: ubuntu-latest
strategy:
matrix:
arch: [amd64, arm64]
include:
- arch: amd64
goarch: amd64
deb_arch: amd64
rpm_arch: x86_64
- arch: arm64
goarch: arm64
deb_arch: arm64
rpm_arch: aarch64
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-version: latest
environment-file: conda/release.yaml
channels: conda-forge,nodefaults
activate-environment: makim
auto-update-conda: true
conda-solver: libmamba
python-version: "3.11"
- name: Install dependencies using Poetry
run: |
poetry config virtualenvs.create false
poetry install
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.0"
- name: Install FPM
run: |
gem install fpm
- name: Verify FPM Installation
run: |
fpm --version || echo "Error: FPM installation failed"
- name: APT Install rpm and snap dependencies
run: |
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo apt-get install -y rpm snapd
- name: Make scripts executable
run: chmod +x packaging/scripts/postinstall.sh
- name: build python standalone binary
run: |
makim --verbose packaging.build_binary
- name: Package DEB for ${{ matrix.arch }}
run: |
makim --verbose packaging.build_deb --version ${{ needs.release.outputs.version }} --architecture ${{ matrix.arch }}
- name: Package RPM for ${{ matrix.arch }}
run: |
makim --verbose packaging.build_rpm --version ${{ needs.release.outputs.version }} --architecture ${{ matrix.arch }}
- name: Package Snap for ${{ matrix.arch }}
run: |
makim --verbose packaging.build_snap --version ${{ needs.release.outputs.version }} --architecture ${{ matrix.arch }}
- name: Upload artifacts (non-pacman)
uses: actions/upload-artifact@v4
with:
name: packages-${{ matrix.arch }}
path: |
*.deb
*.rpm
*.snap
# *.apk
build-pacman:
needs: release
runs-on: ubuntu-latest
container:
image: archlinux:latest
strategy:
matrix:
arch: [amd64, arm64]
steps:
- name: Install base dependencies
run: |
pacman -Syu --noconfirm
pacman -S --noconfirm git python python-pip python-poetry base-devel ruby ruby-erb
- name: Install FPM
run: |
gem install fpm
export GEM_HOME="${HOME}/.local/share/gem"
export PATH="${GEM_HOME}/ruby/3.4.0/bin:$PATH"
# Make sure fpm is in PATH
echo "PATH=${PATH}" >> $GITHUB_ENV
which fpm
- uses: actions/checkout@v4
- name: Set up Python venv
run: |
python -m venv /venv
source /venv/bin/activate
pip install --upgrade pip
pip install pyinstaller rapidfuzz
- name: Install dependencies using Poetry
run: |
source /venv/bin/activate
poetry config virtualenvs.create false
poetry install
- name: Make scripts executable
run: chmod +x packaging/scripts/postinstall.sh
- name: build python standalone binary
run: |
source /venv/bin/activate
makim --verbose packaging.build_binary
- name: Package pacman for ${{ matrix.arch }}
run: |
source /venv/bin/activate
makim --verbose packaging.build_pacman --version ${{ needs.release.outputs.version }} --architecture ${{ matrix.arch }}
- name: Upload pacman artifacts
uses: actions/upload-artifact@v4
with:
name: pacman-packages-${{ matrix.arch }}
path: |
*.pkg.tar.xz
package-release:
needs: [release, build, build-pacman]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download all artifacts
if: needs.release.outputs.version != ''
uses: actions/download-artifact@v4
with:
path: packages
- name: Display structure of downloaded files
if: needs.release.outputs.version != ''
run: ls -R packages
- name: Flatten directory structure
if: needs.release.outputs.version != ''
run: |
mkdir -p release_files
find packages -type f -name "*.deb" -o -name "*.rpm" -o -name "*.snap" -o -name "*.pkg.tar.xz" | xargs -I {} cp {} release_files/
- name: Upload artifacts to existing release
if: needs.release.outputs.version != ''
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.release.outputs.version }}
files: release_files/*
append_body: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}