The updater reads the latest release from Gitea. update::apply refuses to overwrite anything but the CLI. Release workflow builds the Linux CLI; scripts/build-gui.sh builds the Linux and Windows desktop app. Docs say Linux and Windows only. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
73 lines
2.7 KiB
YAML
73 lines
2.7 KiB
YAML
name: Release
|
|
|
|
# Quando uma tag v* é enviada: cria a entrada em "Releases" com as notas do
|
|
# CHANGELOG.md e anexa o CLI compilado (scripts/package-cli.sh), com um .sha256 ao
|
|
# lado de cada pacote. É o que o atualizador (`sabia update`) baixa.
|
|
#
|
|
# O CLI é só para Linux (x86_64 e aarch64), compilado no runner Linux; o x86_64
|
|
# por compilação cruzada. Windows e macOS têm só o app desktop.
|
|
on:
|
|
push:
|
|
tags: ['v*']
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
# Toolchain e registry do cargo ficam no volume que sobrevive entre jobs.
|
|
CARGO_HOME: /opt/hostedtoolcache/cargo
|
|
RUSTUP_HOME: /opt/hostedtoolcache/rustup
|
|
|
|
jobs:
|
|
release:
|
|
name: Cria a release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Release
|
|
env:
|
|
TAG: ${{ gitea.ref_name }}
|
|
TOKEN: ${{ gitea.token }}
|
|
API: ${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}
|
|
run: |
|
|
# Uma execução repetida não recria a release.
|
|
if curl -fsS -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG" >/dev/null 2>&1; then
|
|
echo "a release $TAG já existe"; exit 0
|
|
fi
|
|
scripts/release-notes.sh "$TAG" > notes.md
|
|
pre=false; case "$TAG" in *-*) pre=true ;; esac
|
|
jq -n --arg tag "$TAG" --arg name "Sabiá ${TAG#v}" --rawfile body notes.md --argjson pre "$pre" \
|
|
'{tag_name:$tag, name:$name, body:$body, prerelease:$pre}' > release.json
|
|
curl -fsS -X POST "$API/releases" -H "Authorization: token $TOKEN" \
|
|
-H 'Content-Type: application/json' -d @release.json >/dev/null
|
|
|
|
cli:
|
|
name: CLI (${{ matrix.platform }})
|
|
needs: release
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CARGO_TARGET_DIR: /opt/hostedtoolcache/cargo-target/sabia-release
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- { platform: linux-aarch64, target: aarch64-unknown-linux-gnu, apt: "" }
|
|
- { platform: linux-x86_64, target: x86_64-unknown-linux-gnu, apt: "gcc-x86-64-linux-gnu" }
|
|
steps:
|
|
- uses: actions/checkout@v7
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.target }}
|
|
- name: Linker e ferramentas desta plataforma
|
|
if: ${{ matrix.apt != '' }}
|
|
run: |
|
|
apt-get update -qq
|
|
apt-get install -y -qq ${{ matrix.apt }}
|
|
- name: Compila e empacota
|
|
run: scripts/package-cli.sh "${{ gitea.ref_name }}" "${{ matrix.platform }}" "${{ matrix.target }}" | tee packages.txt
|
|
- name: Anexa à release
|
|
env:
|
|
TOKEN: ${{ gitea.token }}
|
|
API: ${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}
|
|
run: scripts/release-upload.sh "${{ gitea.ref_name }}" $(cat packages.txt)
|