返回提交历史
Modified
.github/workflows/build-packages.yml
+55
-11
Modified
scripts/build-deb.sh
+3
-1
XFEstudio/gpt4free
Add Debian package builds and fix release asset uploads
Co-authored-by: hlohaus <983577+hlohaus@users.noreply.github.com>
b26c6abc
代码差异
2 个文件
+58
-12
@@ -254,6 +254,39 @@ jobs:
254
254
build-args: |
255
255
G4F_VERSION=${{ needs.prepare.outputs.version }}
256
256
257
# Debian Packages
258
build-debian:
259
runs-on: ubuntu-latest
260
needs: prepare
261
strategy:
262
matrix:
263
architecture: [amd64, arm64, armhf]
264
steps:
265
- uses: actions/checkout@v4
266
- name: Set up Python
267
uses: actions/setup-python@v5
268
with:
269
python-version: "3.x"
270
- name: Install build dependencies
271
run: |
272
sudo apt-get update
273
sudo apt-get install -y dpkg-dev build-essential
274
python -m pip install --upgrade pip
275
pip install -r requirements-min.txt
276
pip install -e .
277
- name: Build Debian package
278
env:
279
G4F_VERSION: ${{ needs.prepare.outputs.version }}
280
ARCH: ${{ matrix.architecture }}
281
run: |
282
chmod +x scripts/build-deb.sh
283
./scripts/build-deb.sh
284
- name: Upload Debian package
285
uses: actions/upload-artifact@v4
286
with:
287
name: debian-${{ matrix.architecture }}
288
path: g4f-*-${{ matrix.architecture }}.deb
289
257
290
# WinGet Package Manifest
258
291
create-winget-manifest:
259
292
runs-on: ubuntu-latest
@@ -334,7 +367,7 @@ jobs:
334
367
# Release Creation
335
368
create-release:
336
369
runs-on: ubuntu-latest
337
needs: [prepare, build-pypi, build-windows-exe, build-linux-exe, build-macos-exe, create-winget-manifest]
370
needs: [prepare, build-pypi, build-windows-exe, build-linux-exe, build-macos-exe, build-debian, create-winget-manifest]
338
371
if: needs.prepare.outputs.is_release == 'true'
339
372
permissions: write-all
340
373
steps:
@@ -343,13 +376,15 @@ jobs:
343
376
uses: actions/download-artifact@v4
344
377
with:
345
378
path: ./artifacts
346
- name: Create Release
347
uses: actions/create-release@v1
348
env:
349
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
379
- name: Display artifact structure
380
run: |
381
echo "Downloaded artifacts:"
382
find ./artifacts -type f -name "*" | sort
383
- name: Create Release with Assets
384
uses: softprops/action-gh-release@v2
350
385
with:
351
386
tag_name: ${{ needs.prepare.outputs.version }}
352
release_name: Release ${{ needs.prepare.outputs.version }}
387
name: Release ${{ needs.prepare.outputs.version }}
353
388
body: |
354
389
## g4f ${{ needs.prepare.outputs.version }}
355
390
@@ -363,6 +398,11 @@ jobs:
363
398
- Linux: Download `g4f-linux-${{ needs.prepare.outputs.version }}`
364
399
- macOS: Download `g4f-macos-${{ needs.prepare.outputs.version }}`
365
400
401
**Debian Packages:**
402
- AMD64: `g4f-${{ needs.prepare.outputs.version }}-amd64.deb`
403
- ARM64: `g4f-${{ needs.prepare.outputs.version }}-arm64.deb`
404
- ARMv7: `g4f-${{ needs.prepare.outputs.version }}-armhf.deb`
405
366
406
**System Packages:**
367
407
- WinGet: `winget install g4f` (after manifest approval)
368
408
@@ -371,11 +411,15 @@ jobs:
371
411
- `docker pull hlohaus789/g4f:${{ needs.prepare.outputs.version }}-slim`
372
412
draft: false
373
413
prerelease: false
374
- name: Upload Release Assets
375
run: |
376
# Upload all built artifacts as release assets
377
# This would typically use a more sophisticated asset upload action
378
echo "Release created with tag ${{ needs.prepare.outputs.version }}"
414
files: |
415
./artifacts/pypi-package/*
416
./artifacts/windows-exe/*
417
./artifacts/linux-exe/*
418
./artifacts/macos-exe/*
419
./artifacts/debian-amd64/*
420
./artifacts/debian-arm64/*
421
./artifacts/debian-armhf/*
422
token: ${{ secrets.GITHUB_TOKEN }}
379
423
380
424
# Publish to PyPI (only for releases)
381
425
publish-pypi:
@@ -69,7 +69,7 @@ chmod 755 debian/${PACKAGE_NAME}/DEBIAN/prerm
69
69
70
70
# Install the package files
71
71
export PYTHONPATH=""
72
python3 setup.py install --root=debian/${PACKAGE_NAME} --prefix=/usr --install-lib=/usr/lib/python3/dist-packages
72
python3 setup.py install --root=debian/${PACKAGE_NAME} --prefix=/usr --install-lib=/usr/lib/python3/dist-packages --install-scripts=/usr/bin
73
73
74
74
# Create documentation
75
75
cp README.md debian/${PACKAGE_NAME}/usr/share/doc/${PACKAGE_NAME}/
@@ -93,6 +93,8 @@ EOF
93
93
find debian/${PACKAGE_NAME} -type d -exec chmod 755 {} \;
94
94
find debian/${PACKAGE_NAME} -type f -exec chmod 644 {} \;
95
95
chmod 755 debian/${PACKAGE_NAME}/usr/bin/g4f
96
chmod 755 debian/${PACKAGE_NAME}/DEBIAN/postinst
97
chmod 755 debian/${PACKAGE_NAME}/DEBIAN/prerm
96
98
97
99
# Calculate installed size
98
100
INSTALLED_SIZE=$(du -sk debian/${PACKAGE_NAME}/usr | cut -f1)