Files
TUI-WM/.gitea/workflows/release.yaml
Bjorn Blomberg 87ff0e1b77 Wide-glyph damage expansion, screenshot dir in settings, install command on releases
- SafeBackend now tracks wide cells and explicitly overwrites the
  right half when a wide glyph is replaced by a narrow one — the case
  ratatui's diff cannot see (both buffers hold a space there) and the
  likely remaining source of ghost glyphs
- Settings dialog: new 'Skärmbilder' row edits screenshot_dir (saved
  to config.toml, applied immediately)
- Release workflow writes an install one-liner (arch-detecting curl)
  into the release body and updates it on every build
- Integration suite: 50/50

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 00:52:26 +02:00

90 lines
4.0 KiB
YAML

name: release
# På varje push till master/main: kör tester, bygg release-binärer för
# linux arm64 (nativt på Pi5-runnern) + linux x64 (cross) och lägg dem
# på en rullande "latest"-release på släppsidan i Gitea.
on:
push:
branches: [master, main]
workflow_dispatch: {}
jobs:
build-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Installera Rust + cross-toolchain
run: |
set -e
sudo apt-get update -qq
sudo apt-get install -y -qq gcc-x86-64-linux-gnu jq curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --profile minimal --default-toolchain stable
. "$HOME/.cargo/env"
rustup target add x86_64-unknown-linux-gnu
- name: Testa + bygg (arm64 nativt + x64 cross)
run: |
set -e
. "$HOME/.cargo/env"
# Snäll mot Pi5:n — låg prio och max 2 parallella jobb
export CARGO_BUILD_JOBS=2
nice -n 10 cargo test --release
nice -n 10 cargo build --release
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=x86_64-linux-gnu-gcc
nice -n 10 cargo build --release --target x86_64-unknown-linux-gnu
mkdir -p build
cp target/release/tui-wm build/tui-wm-linux-arm64
cp target/x86_64-unknown-linux-gnu/release/tui-wm build/tui-wm-linux-x64
# Standardkonfiguration (config + paneler + teman) som eget paket.
# Binären kan också skapa allt själv med `tui-wm --init`.
tar czf build/tui-wm-config.tar.gz config.toml panels themes
(cd build && sha256sum tui-wm-linux-* tui-wm-config.tar.gz > checksums.txt && ls -la)
- name: Skapa/uppdatera latest-release + ladda upp binärer
env:
API: http://gitea-d:3000/api/v1
REPO: ${{ github.repository }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
TAG="latest"
BASE="https://gitea.brasse-pc.eu/$REPO/releases/download/$TAG"
BODY=$(cat <<EOF
Rullande bygge från senaste master. Commit: ${{ github.sha }}. Arkitekturer: linux x64 + arm64 (Pi5).
## Installera / uppdatera
\`\`\`bash
mkdir -p ~/.local/bin && curl -fsSL "$BASE/tui-wm-linux-\$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')" -o ~/.local/bin/tui-wm && chmod +x ~/.local/bin/tui-wm && ~/.local/bin/tui-wm --init
\`\`\`
Kör sedan \`tui-wm\` (se till att \`~/.local/bin\` finns i \$PATH).
\`--init\` skriver standardkonfiguration till ~/.config/tui-wm — hoppa över den vid uppdatering.
EOF
)
rid=$(curl -s -X POST "$API/repos/$REPO/releases" \
-H "Authorization: token $TOKEN" -H 'Content-Type: application/json' \
-d "$(jq -n --arg tag "$TAG" --arg body "$BODY" '{tag_name:$tag,name:$tag,body:$body}')" | jq -r '.id // empty')
if [ -z "$rid" ]; then
rid=$(curl -s "$API/repos/$REPO/releases/tags/$TAG" \
-H "Authorization: token $TOKEN" | jq -r '.id')
curl -s -X PATCH "$API/repos/$REPO/releases/$rid" \
-H "Authorization: token $TOKEN" -H 'Content-Type: application/json' \
-d "$(jq -n --arg body "$BODY" '{body:$body}')" -o /dev/null
fi
echo "release id: $rid"
for f in tui-wm-linux-x64 tui-wm-linux-arm64 tui-wm-config.tar.gz checksums.txt; do
aid=$(curl -s "$API/repos/$REPO/releases/$rid/assets" \
-H "Authorization: token $TOKEN" | jq -r ".[] | select(.name==\"$f\") | .id")
if [ -n "$aid" ] && [ "$aid" != "null" ]; then
curl -s -X DELETE "$API/repos/$REPO/releases/$rid/assets/$aid" \
-H "Authorization: token $TOKEN" -o /dev/null
fi
curl -s -X POST "$API/repos/$REPO/releases/$rid/assets?name=$f" \
-H "Authorization: token $TOKEN" \
-F "attachment=@build/$f" -o /dev/null -w " $f -> HTTP %{http_code}\n"
done