-
Notifications
You must be signed in to change notification settings - Fork 0
88 lines (74 loc) · 2.87 KB
/
Copy pathrelease.yml
File metadata and controls
88 lines (74 loc) · 2.87 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
# 推送 v* / V* tag(或手动触发)时构建:
# - ubuntu-24.04: .deb 与 .AppImage (amd64)
# - windows-latest: OpenCodeGoMonitor.exe (win64 便携版)
# 并自动附加到对应 GitHub Release。
name: Build release packages
on:
push:
tags: ["v*", "V*"]
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install system deps
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libgl1 libegl1 libxkbcommon0 libxcb-cursor0 libdbus-1-3 libasound2t64
# build.sh 需要 appimagetool 生成 .AppImage(runner 预装镜像中没有)
- name: Install appimagetool
run: |
sudo wget -qO /usr/local/bin/appimagetool \
https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
sudo chmod +x /usr/local/bin/appimagetool
# 包装一层 --appimage-extract-and-run,runner 上无需 FUSE
printf '#!/bin/sh\nexec /usr/local/bin/appimagetool --appimage-extract-and-run "$@"\n' \
| sudo tee /usr/local/bin/appimagetool-wrapper >/dev/null
sudo chmod +x /usr/local/bin/appimagetool-wrapper
echo "APPIMAGETOOL=/usr/local/bin/appimagetool-wrapper" >> "$GITHUB_ENV"
- name: Prepare build venv
run: |
python3 -m venv .venv
.venv/bin/pip install -U pip wheel
.venv/bin/pip install -r requirements.txt pyinstaller pillow
- name: Build .deb and AppImage (amd64)
env:
PYINSTALLER_BIN: ${{ github.workspace }}/.venv/bin/pyinstaller
run: |
VERSION="${GITHUB_REF_NAME##*[vV]}"
[ -n "$VERSION" ] || VERSION="dev"
PATH="${{ github.workspace }}/.venv/bin:$PATH" bash packaging/build.sh "$VERSION"
- name: Attach artifacts to Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
dist/*.deb
dist/*.AppImage
generate_release_notes: true
build-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install build deps
run: |
python -m pip install -U pip wheel
python -m pip install -r requirements.txt pyinstaller
- name: Build portable exe (win64)
run: python -m PyInstaller OpenCodeGoMonitor.spec --noconfirm --clean
- name: Attach exe to Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: dist/OpenCodeGoMonitor.exe
generate_release_notes: true