feat(ci): versão no tray (app.getVersion) + workflow build/release (CI por commit; release na tag)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
|||||||
|
name: client-build-release
|
||||||
|
|
||||||
|
# Client desktop (Electron). DIFERENTE dos serviços web: a versão é EMBUTIDA no .exe no
|
||||||
|
# build (o electron-updater compara versões), então NÃO há "build once" puro:
|
||||||
|
# • push na main → BUILD de VALIDAÇÃO (cross-compile), NÃO publica.
|
||||||
|
# • tag vX.Y.Z → RELEASE: builda com a versão da TAG e publica em updates/ (auto-update).
|
||||||
|
# Mantém o electron-updater/latest.yml (clients em campo dependem). O .exe não muda de mecanismo —
|
||||||
|
# só a ORIGEM da versão (tag) e o gatilho (tag, não push). Ver Documentos-Unicos/projetos/rx.scoreodonto.com-client.
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
tags: ['v*']
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# ───────── Validação no push (não publica) ─────────
|
||||||
|
build:
|
||||||
|
if: startsWith(github.ref, 'refs/heads/')
|
||||||
|
runs-on: self-hosted
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Build de validação (cross-compile Windows; NÃO publica)
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
NODE_ENV=development npm install --include=dev
|
||||||
|
npx electron-builder --win --x64 --publish never
|
||||||
|
ls dist/*.exe >/dev/null && echo "OK: .exe compila. Push NÃO publica (release só em tag)."
|
||||||
|
|
||||||
|
# ───────── Release na tag (builda com a versão da tag + publica) ─────────
|
||||||
|
release:
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
runs-on: self-hosted
|
||||||
|
steps:
|
||||||
|
- name: Checkout (na tag)
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Versão da TAG → package.json
|
||||||
|
run: |
|
||||||
|
V="${GITHUB_REF_NAME#v}"
|
||||||
|
npm version "$V" --no-git-tag-version --allow-same-version
|
||||||
|
echo "versão do build = $V (da tag $GITHUB_REF_NAME)"
|
||||||
|
- name: Build do .exe + latest.yml (com a versão da tag)
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
NODE_ENV=development npm install --include=dev
|
||||||
|
npx electron-builder --win --x64 --publish never
|
||||||
|
ls dist/*.exe dist/latest.yml
|
||||||
|
- name: Publicar em produção (VPS1 updates/) — auto-update dos clients
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
ssh -o StrictHostKeyChecking=accept-new deploy@10.99.0.1 \
|
||||||
|
'mkdir -p /home/deploy/stack/rx.scoreodonto.com/dental-server/updates'
|
||||||
|
rsync -avz dist/*.exe dist/*.blockmap dist/latest.yml \
|
||||||
|
deploy@10.99.0.1:/home/deploy/stack/rx.scoreodonto.com/dental-server/updates/
|
||||||
|
echo "Publicado $GITHUB_REF_NAME em updates/. Clients puxam pelo latest.yml."
|
||||||
@@ -423,6 +423,7 @@ function updateTrayMenu(countdown = null, countdownInterval = null, updateVersio
|
|||||||
|
|
||||||
const template = [
|
const template = [
|
||||||
{ label: statusText, enabled: false },
|
{ label: statusText, enabled: false },
|
||||||
|
{ label: `Versão v${app.getVersion()}`, enabled: false },
|
||||||
{ type: 'separator' }
|
{ type: 'separator' }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user