mirror of
https://github.com/LowderPlay/cheburcheck.git
synced 2026-09-27 01:00:14 +03:00
feat: probe autoupdate (#88)
* feat: autoupdate * chore: bump version * feat: publish installer * fix: standalone builds * ci: release docs * fix: windows icmp socket * docs: windows notice * docs: remove line breaks
This commit is contained in:
@@ -34,6 +34,12 @@ jobs:
|
||||
- name: Build release binary
|
||||
run: cargo build --release --package probe --bin cheburprobe --target x86_64-unknown-linux-musl
|
||||
|
||||
- name: Name Linux amd64 release asset
|
||||
run: |
|
||||
version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "probe") | .version')
|
||||
cp target/x86_64-unknown-linux-musl/release/cheburprobe \
|
||||
"target/x86_64-unknown-linux-musl/release/cheburprobe-$version-linux-amd64"
|
||||
|
||||
- name: Build Debian package
|
||||
run: cargo deb --package probe --target x86_64-unknown-linux-musl --no-strip --no-build -- --bin cheburprobe
|
||||
|
||||
@@ -41,7 +47,7 @@ jobs:
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: cheburprobe-linux-amd64
|
||||
path: target/x86_64-unknown-linux-musl/release/cheburprobe
|
||||
path: target/x86_64-unknown-linux-musl/release/cheburprobe-*-linux-amd64
|
||||
compression-level: 0
|
||||
|
||||
- name: Upload Linux amd64 Debian package
|
||||
@@ -74,6 +80,12 @@ jobs:
|
||||
- name: Build Debian package
|
||||
run: cargo deb --package probe --target aarch64-unknown-linux-musl --no-strip --no-build -- --bin cheburprobe
|
||||
|
||||
- name: Name Linux arm64 release asset
|
||||
run: |
|
||||
version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | select(.name == "probe") | .version')
|
||||
cp target/aarch64-unknown-linux-musl/release/cheburprobe \
|
||||
"target/aarch64-unknown-linux-musl/release/cheburprobe-$version-linux-arm64"
|
||||
|
||||
- name: Build legacy OpenWrt opkg packages
|
||||
run: |
|
||||
chmod +x probe/openwrt/build-ipk.sh
|
||||
@@ -102,7 +114,7 @@ jobs:
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: cheburprobe-linux-arm64
|
||||
path: target/aarch64-unknown-linux-musl/release/cheburprobe
|
||||
path: target/aarch64-unknown-linux-musl/release/cheburprobe-*-linux-arm64
|
||||
compression-level: 0
|
||||
|
||||
- name: Upload Linux arm64 Debian package
|
||||
@@ -133,11 +145,18 @@ jobs:
|
||||
- name: Build release binary
|
||||
run: cargo build --release --package probe --bin cheburprobe
|
||||
|
||||
- name: Name Windows release asset
|
||||
shell: pwsh
|
||||
run: |
|
||||
$metadata = cargo metadata --no-deps --format-version 1 | ConvertFrom-Json
|
||||
$version = ($metadata.packages | Where-Object name -eq 'probe').version
|
||||
Copy-Item target/release/cheburprobe.exe "target/release/cheburprobe-$version-windows-x86_64.exe"
|
||||
|
||||
- name: Upload Windows amd64 binary
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: cheburprobe-windows-amd64
|
||||
path: target/release/cheburprobe.exe
|
||||
path: target/release/cheburprobe-*-windows-x86_64.exe
|
||||
compression-level: 0
|
||||
|
||||
docker:
|
||||
|
||||
@@ -149,11 +149,98 @@ jobs:
|
||||
rm -rf "$extract_dir"
|
||||
done
|
||||
|
||||
- name: Generate release body
|
||||
uses: actions/github-script@v8
|
||||
env:
|
||||
TAG_NAME: ${{ github.ref_name }}
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const tag = process.env.TAG_NAME;
|
||||
const files = fs.readdirSync('release-artifacts')
|
||||
.filter((name) => fs.statSync(path.join('release-artifacts', name)).isFile())
|
||||
.sort();
|
||||
|
||||
function describe(name) {
|
||||
if (/^cheburchecker_.+_amd64\.deb$/.test(name)) {
|
||||
return 'Пакет Cheburchecker для Debian Linux x86-64.';
|
||||
}
|
||||
if (/^cheburchecker_.+_arm64\.deb$/.test(name)) {
|
||||
return 'Пакет Cheburchecker для Debian Linux ARM64.';
|
||||
}
|
||||
if (/^cheburprobe-.+-linux-amd64$/.test(name)) {
|
||||
return 'Cheburprobe для Linux x86-64.';
|
||||
}
|
||||
if (/^cheburprobe-.+-linux-arm64$/.test(name)) {
|
||||
return 'Cheburprobe для Linux ARM64.';
|
||||
}
|
||||
if (/^cheburprobe-.+-windows-x86_64\.exe$/.test(name)) {
|
||||
return 'Cheburprobe для Windows x86-64.';
|
||||
}
|
||||
if (/^cheburprobe_.+_amd64\.deb$/.test(name)) {
|
||||
return 'Пакет Cheburprobe для Debian Linux x86-64 с сервисом и автообновлением.';
|
||||
}
|
||||
if (/^cheburprobe_.+_arm64\.deb$/.test(name)) {
|
||||
return 'Пакет Cheburprobe для Debian Linux ARM64 с сервисом и автообновлением.';
|
||||
}
|
||||
if (/^cheburprobe-.+_.+\.apk$/.test(name)) {
|
||||
return 'Пакет Cheburprobe для версий OpenWrt с пакетным менеджером APK (25.12+).';
|
||||
}
|
||||
if (/^luci-app-cheburprobe-.+\.apk$/.test(name)) {
|
||||
return 'Интерфейс LuCI для APK-пакета Cheburprobe.';
|
||||
}
|
||||
if (/^cheburprobe_.+_.+\.ipk$/.test(name)) {
|
||||
return 'Пакет Cheburprobe для версий OpenWrt с пакетным менеджером opkg.';
|
||||
}
|
||||
if (/^luci-app-cheburprobe_.+_all\.ipk$/.test(name)) {
|
||||
return 'Интерфейс LuCI для IPK-пакета Cheburprobe.';
|
||||
}
|
||||
return 'Файл релиза.';
|
||||
}
|
||||
|
||||
const baseUrl = [
|
||||
'https://github.com',
|
||||
encodeURIComponent(context.repo.owner),
|
||||
encodeURIComponent(context.repo.repo),
|
||||
'releases',
|
||||
'download',
|
||||
encodeURIComponent(tag),
|
||||
].join('/');
|
||||
const sourceBaseUrl = [
|
||||
'https://github.com',
|
||||
encodeURIComponent(context.repo.owner),
|
||||
encodeURIComponent(context.repo.repo),
|
||||
'blob',
|
||||
encodeURIComponent(tag),
|
||||
].join('/');
|
||||
const rows = files.map((name) => {
|
||||
const url = baseUrl + '/' + encodeURIComponent(name);
|
||||
return '| [`' + name + '`](' + url + ') | ' + describe(name) + ' |';
|
||||
});
|
||||
const body = [
|
||||
'## Документация',
|
||||
'',
|
||||
'- [Cheburprobe](' + sourceBaseUrl + '/probe/README.md)',
|
||||
'- [Cheburchecker](' + sourceBaseUrl + '/reporter/README.md)',
|
||||
'',
|
||||
'## Файлы релиза',
|
||||
'',
|
||||
'| Файл | Описание |',
|
||||
'| --- | --- |',
|
||||
...rows,
|
||||
'',
|
||||
].join('\n');
|
||||
|
||||
fs.writeFileSync('release-body.md', body);
|
||||
|
||||
- name: Publish draft release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: ${{ github.ref_name }}
|
||||
draft: true
|
||||
body_path: release-body.md
|
||||
fail_on_unmatched_files: true
|
||||
files: release-artifacts/*
|
||||
|
||||
Reference in New Issue
Block a user