forked from Mzdyl/LiteLoaderQQNT_Install
-
Notifications
You must be signed in to change notification settings - Fork 0
194 lines (166 loc) · 6.89 KB
/
windows.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
name: Windows
on:
push:
if: contains(github.event.head_commit.message, 'pre-release')
paths:
- "install_windows.py"
- ".github/workflows/windows.yml"
pull_request:
paths:
- "install_windows.py"
- ".github/workflows/windows.yml"
workflow_dispatch:
concurrency:
group: windows
cancel-in-progress: false
jobs:
build-test:
strategy:
matrix:
builder: [pyinstaller, nuitka]
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Download External Data Release
id: download_data
run: |
# 获取 LiteLoaderQQNT 的最新版本
$LLtag = (Invoke-RestMethod -Uri "https://api.github.com/repos/LiteLoaderQQNT/LiteLoaderQQNT/releases/latest").tag_name
echo "LLtag=$LLtag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
# 获取 LL-plugin-list-viewer 的最新版本
$LVtag = (Invoke-RestMethod -Uri "https://api.github.com/repos/ltxhhz/LL-plugin-list-viewer/releases/latest").tag_name
echo "LVtag=$LVtag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
curl -L -o "LiteLoaderQQNT-${LLtag}.zip" "https://github.com/LiteLoaderQQNT/LiteLoaderQQNT/releases/download/${LLtag}/LiteLoaderQQNT.zip"
curl -L -o "list-viewer-${LVtag}.zip" "https://github.com/ltxhhz/LL-plugin-list-viewer/releases/download/${LVtag}/list-viewer.zip"
dir
- name: Restore Cache
uses: actions/cache/restore@v4
if: matrix.builder == 'nuitka'
with:
path: nuitka_cache
key: nuitka-cache
restore-keys: nuitka-
- name: Build by ${{ matrix.builder }}
env:
LLtag: ${{ env.LLtag }}
LVtag: ${{ env.LVtag }}
run: |
python -m pip install ${{ matrix.builder }}
if ('${{ matrix.builder }}' -eq 'nuitka') {
$env:NUITKA_CACHE_DIR = "nuitka_cache"
nuitka --onefile --windows-uac-admin --include-data-files="LiteLoaderQQNT-$($env:LLtag).zip"="./" --include-data-files="list-viewer-$($env:LVtag).zip"="./" install_windows.py --output-dir="dist" --output-file="install_windows_nuitka" --assume-yes-for-downloads --enable-plugins="tk-inter" --enable-console --mingw64
} else {
pyinstaller --onefile --uac-admin --add-data "LiteLoaderQQNT-$($env:LLtag).zip:." --add-data "list-viewer-$($env:LVtag).zip:." install_windows.py --distpath dist --name install_windows_pyinstaller
}
- name: Save Cache
uses: actions/cache/save@v4
if: matrix.builder == 'nuitka'
with:
path: nuitka_cache
key: nuitka-cache
- name: Upload install_windows_${{ matrix.builder }}.exe
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.builder }}
path: dist/install_windows_${{ matrix.builder }}.exe
- name: Download and Install QQ Software
run: |
# Download QQ software
python -m pip install requests
python get_qqnt.py Windowsx64
# Install QQ silently
Start-Process -FilePath QQInstaller.exe -ArgumentList '/S' -Wait
- name: Run install_windows_${{ matrix.builder }}.exe
run: |
.\dist\install_windows_${{ matrix.builder }}.exe
- name: Check QQNT Process
run: |
Start-Process -FilePath "C:\Program Files\Tencent\QQNT\QQ.exe" -ArgumentList '--enable-logging' -NoNewWindow
Start-Sleep -Seconds 5 # 等待 5 秒
Get-Process -Name "QQ" # 检查 QQ 进程是否在运行
- name: Check if LiteLoader plugins folder exists
run: |
if (Test-Path "C:\Program Files\Tencent\QQNT\resources\app\LiteLoaderQQNT\data") {
Write-Host "LiteLoader folder found. Test passed."
} else {
Write-Host "LiteLoader folder not found. Test failed."
exit 1
}
- name: Delete LiteLoaderQQNT-main directory
run: |
# 检查目录是否存在
if (Test-Path "C:\Program Files\Tencent\QQNT\resources\app\LiteLoaderQQNT") {
# 删除目录
Remove-Item -Recurse -Force "C:\Program Files\Tencent\QQNT\resources\app\LiteLoaderQQNT"
Write-Output "Deleted: C:\Program Files\Tencent\QQNT\resources\app\LiteLoaderQQNT"
} else {
Write-Output "Directory does not exist."
}
- name: Block GitHub access
run: |
# hosts 禁止容易不生效,直接禁止应用联网
New-NetFirewallRule -DisplayName "Block install_windows_${{ matrix.builder }}.exe" -Direction Outbound -Program "$PWD\dist\install_windows_${{ matrix.builder }}.exe" -Action Block -Profile Domain,Private,Public
- name: ReRun install_windows_${{ matrix.builder }}.exe
run: |
.\dist\install_windows_${{ matrix.builder }}.exe
- name: Check QQNT Process
run: |
Start-Process -FilePath "C:\Program Files\Tencent\QQNT\QQ.exe" -ArgumentList '--enable-logging' -NoNewWindow
Start-Sleep -Seconds 5 # 等待 5 秒
Get-Process -Name "QQ" # 检查 QQ 进程是否在运行
- name: Check if LiteLoader plugins folder exists
run: |
if (Test-Path "C:\Program Files\Tencent\QQNT\resources\app\LiteLoaderQQNT\data") {
Write-Host "LiteLoader folder found. Test passed."
} else {
Write-Host "LiteLoader folder not found. Test failed."
exit 1
}
release:
if: contains(github.event.head_commit.message, 'pre-release')
permissions:
contents: write
needs: [build-test]
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download
uses: actions/download-artifact@v4
- name: Create notes
run: git log --pretty=format:"* %h %s by @%an" "$(git tag -l --column=plain --sort=-creatordate "[0-9]*.[0-9]*" | head -1)..HEAD" > body.txt
- name: Delete Alpha
env:
GH_TOKEN: ${{ github.token }}
run: |
if
gh release view Alpha-windows
then
gh release delete Alpha-windows -y
fi
if
git tag -d Alpha-windows
then
git push origin :refs/tags/Alpha-windows
fi
- name: Prerelease
uses: softprops/action-gh-release@v2
with:
tag_name: Alpha-windows
prerelease: true
body_path: body.txt
files: |
pyinstaller/install_windows_pyinstaller.exe
nuitka/install_windows_nuitka.exe