-
Notifications
You must be signed in to change notification settings - Fork 0
141 lines (135 loc) · 5.16 KB
/
Copy pathrelease.yml
File metadata and controls
141 lines (135 loc) · 5.16 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.asset }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
asset: x86_64-unknown-linux-gnu
archive: tar.gz
binary: vimit
features: ""
- os: ubuntu-latest
asset: aarch64-unknown-linux-gnu
archive: tar.gz
binary: vimit
cross: true
features: ""
- os: windows-latest
asset: x86_64-pc-windows-msvc
archive: zip
binary: vimit.exe
features: "--features gui"
gui_binary: vimit-gui.exe
- os: macos-latest
asset: aarch64-apple-darwin
archive: tar.gz
binary: vimit
features: "--features gui"
gui_binary: vimit-gui
steps:
- uses: actions/checkout@v4
- name: Install cross-compilation tools
if: matrix.cross
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Add cross-compilation target
if: matrix.cross
run: rustup target add aarch64-unknown-linux-gnu
- name: Build release binary
run: cargo build --release ${{ matrix.features }} --locked ${{ matrix.cross && '--target aarch64-unknown-linux-gnu' || '' }}
- name: Package Unix binary
if: runner.os != 'Windows'
shell: bash
run: |
mkdir -p dist/temp
if [ "${{ matrix.cross }}" = "true" ]; then
cp "target/aarch64-unknown-linux-gnu/release/${{ matrix.binary }}" dist/temp/
else
cp "target/release/${{ matrix.binary }}" dist/temp/
if [ -n "${{ matrix.gui_binary }}" ]; then
cp "target/release/${{ matrix.gui_binary }}" dist/temp/
fi
fi
cp README.md README.ru.md LICENSE .env.example dist/temp/
name="vimit-${GITHUB_REF_NAME}-${{ matrix.asset }}"
tar -czf "dist/${name}.tar.gz" -C dist/temp .
shasum -a 256 "dist/${name}.tar.gz" > "dist/${name}.tar.gz.sha256"
- name: Package Windows binary
if: runner.os == 'Windows'
shell: pwsh
run: |
$name = "vimit-${env:GITHUB_REF_NAME}-${{ matrix.asset }}"
New-Item -ItemType Directory -Force -Path "dist/temp" | Out-Null
Copy-Item "target/release/${{ matrix.binary }}" "dist/temp/"
if ("${{ matrix.gui_binary }}" -ne "") {
Copy-Item "target/release/${{ matrix.gui_binary }}" "dist/temp/"
}
Copy-Item README.md,README.ru.md,LICENSE,.env.example "dist/temp/"
Copy-Item packaging/windows/*.cmd "dist/temp/"
Compress-Archive -Path "dist/temp/*" -DestinationPath "dist/$name.zip" -Force
$hash = Get-FileHash "dist/$name.zip" -Algorithm SHA256
"$($hash.Hash.ToLower()) $name.zip" | Out-File -Encoding ascii "dist/$name.zip.sha256"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset }}
path: dist/*
publish:
name: Publish GitHub release
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v4
with:
path: release-assets
- name: Publish assets
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
shell: bash
run: |
cat > notes.md <<'EOF'
Rust CLI + GUI release.
Highlights:
- Single native binary per platform (Windows, Linux, macOS, ARM).
- No Python, pip, venv, or runtime package dependencies.
- `--demo` works without a VibeMode key or network.
- `--monitor` with ratatui TUI: gauges, sparklines, color coding.
- `--preset full|compact|mini` for different terminal sizes.
- `--threshold 5h=80:95,7d=90` for per-window alert thresholds.
- Robust schema tolerance for API changes.
- Desktop notifications with escalation tracking.
- Slint GUI with settings panel (build with `--features gui`).
- English and Russian docs, Termux/Android guide.
EOF
if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release edit "$TAG" \
--repo "$GITHUB_REPOSITORY" \
--title "vimit ${TAG}" \
--notes-file notes.md \
--draft=false \
--prerelease=false \
--latest
else
gh release create "$TAG" \
--repo "$GITHUB_REPOSITORY" \
--title "vimit ${TAG}" \
--notes-file notes.md \
--draft=false \
--prerelease=false \
--latest
fi
while IFS= read -r -d '' file; do
gh release upload "$TAG" "$file" --repo "$GITHUB_REPOSITORY" --clobber
done < <(find release-assets -type f \( -name '*.tar.gz' -o -name '*.zip' -o -name '*.sha256' \) -print0)