Skip to content

Commit 11e4be4

Browse files
committed
release: notas + workflow com zip/tar.gz e checksums
1 parent f6e70c4 commit 11e4be4

File tree

2 files changed

+190
-0
lines changed

2 files changed

+190
-0
lines changed

.github/workflows/release.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*" # dispara quando fizer push de uma tag vX.Y.Z
7+
workflow_dispatch: # permite correr manualmente
8+
9+
concurrency:
10+
group: release-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
build:
15+
name: Build (multi-OS/arch)
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- { goos: linux, goarch: amd64, ext: "" }
25+
- { goos: linux, goarch: arm64, ext: "" }
26+
- { goos: windows, goarch: amd64, ext: ".exe" }
27+
- { goos: windows, goarch: arm64, ext: ".exe" }
28+
- { goos: darwin, goarch: amd64, ext: "" }
29+
- { goos: darwin, goarch: arm64, ext: "" }
30+
31+
env:
32+
CGO_ENABLED: 0
33+
APP_NAME: sharepoint-client
34+
MAIN_PKG: ./cmd/sharepoint-client
35+
VERSION: ${{ github.ref_name }} # ex.: v0.3.0
36+
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
41+
- name: Setup Go
42+
uses: actions/setup-go@v5
43+
with:
44+
go-version: "1.22.x"
45+
cache: true
46+
47+
- name: Derive build metadata
48+
id: meta
49+
run: |
50+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
51+
echo "commit=${GITHUB_SHA}" >> $GITHUB_OUTPUT
52+
echo "date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT
53+
54+
- name: Build (${{ matrix.goos }}/${{ matrix.goarch }})
55+
shell: bash
56+
run: |
57+
OUTDIR="dist/${{ matrix.goos }}_${{ matrix.goarch }}"
58+
mkdir -p "$OUTDIR"
59+
BIN="${APP_NAME}${{ matrix.ext }}"
60+
61+
# Ajusta estes -X para os nomes das tuas vars em main.go se forem diferentes:
62+
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -trimpath \
63+
-ldflags "-s -w \
64+
-X 'main.buildVersion=${{ steps.meta.outputs.version }}' \
65+
-X 'main.buildCommit=${{ steps.meta.outputs.commit }}' \
66+
-X 'main.buildDate=${{ steps.meta.outputs.date }}'" \
67+
-o "$OUTDIR/$BIN" "$MAIN_PKG"
68+
69+
# Copiar docs úteis (se existirem)
70+
for F in README.md Readme.md RELEASE_NOTES.md LICENSE LICENSE.txt; do
71+
if [ -f "$F" ]; then cp "$F" "$OUTDIR/"; fi
72+
done
73+
74+
# Empacotar por OS
75+
PKGBASE="${APP_NAME}_${VERSION}_${{ matrix.goos }}_${{ matrix.goarch }}"
76+
pushd "$OUTDIR" >/dev/null
77+
if [ "${{ matrix.goos }}" = "windows" ]; then
78+
zip -9 "../${PKGBASE}.zip" ./* >/dev/null
79+
else
80+
tar -czf "../${PKGBASE}.tar.gz" ./*
81+
fi
82+
popd >/dev/null
83+
84+
- name: Generate checksums
85+
shell: bash
86+
run: |
87+
cd dist
88+
ls -1 *.tar.gz *.zip 2>/dev/null | xargs -r sha256sum | tee "checksums_${VERSION}.txt"
89+
90+
- name: Upload build artifacts
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: dist
94+
path: dist/**
95+
96+
release:
97+
name: Create GitHub Release
98+
runs-on: ubuntu-latest
99+
needs: build
100+
permissions:
101+
contents: write
102+
103+
steps:
104+
- name: Download artifacts
105+
uses: actions/download-artifact@v4
106+
with:
107+
name: dist
108+
path: dist
109+
110+
- name: Publish GitHub Release
111+
uses: softprops/action-gh-release@v2
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
with:
115+
tag_name: ${{ github.ref_name }}
116+
name: ${{ github.ref_name }}
117+
draft: false
118+
prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') }}
119+
files: |
120+
dist/*.tar.gz
121+
dist/*.zip
122+
dist/checksums_*.txt
123+
body: |
124+
See **RELEASE_NOTES.md** for details.

RELEASE_NOTES.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# sharepoint-client – v1.0.0
2+
3+
## Destaques
4+
- **Leitura robusta** de listas SPO com paginação `$skiptoken` (`--all`) e tolerância a throttling.
5+
- **Fallback inteligente** quando há `SPQueryThrottledException` (varre sem filtro no servidor e filtra em memória se possível).
6+
- **Controlos de timeout**
7+
- `--http-timeout` por pedido.
8+
- `--global-timeout` para a operação inteira (usar `0` para dumps completos sem limite).
9+
- **Saídas para pipelines**: `json`, `jsonl`, `csv`, e `--clean-output` para remover `__metadata`.
10+
- **Pós-leitura em escrita**: `add-item` e `update-item` devolvem o estado real atualizado (honrando `--select`).
11+
- **“Últimos N registos” pronto a usar**: se usares `--top N` sem `--orderby`, assume `ID desc`.
12+
- **Summary claro**: `items, pages, throttled, partial, fallback, stoppedEarly, topSatisfied`.
13+
14+
## Melhorias recentes (v1.0.0)
15+
- `stoppedEarly` no resumo (distingue *timeout/throttle* vs “parei porque já tinha `top`”).
16+
- `topSatisfied` mais fiel em `--all`.
17+
- Normalização `ID` vs `Id` documentada.
18+
- Refactor de `add/update` (pós-leitura partilhada).
19+
- Debug do modo Edge resolvido: `useTempProfile`, `headlessFirst`, `interactiveFallback`, etc.
20+
- Cache de cookies endurecida (ficheiro 0600) + metadados de `site`/`cachedAt` em debug.
21+
22+
## CLI (resumo)
23+
```text
24+
Modes: list-items | latest-item | get-item | add-item | update-item | delete-item
25+
Saída: --output json|jsonl|csv (usar --clean-output para remover "__...")
26+
27+
Leitura típica:
28+
--list <nome> --select "Id,Matricula,..." [--where/--filter ...] [--orderby ...]
29+
--top N (sem --orderby → assume "ID desc")
30+
--all (varre a lista toda com paginação)
31+
--summary (imprime resumo técnico em stderr)
32+
33+
Timeouts:
34+
--http-timeout <s> (default 30)
35+
--global-timeout <s> (0 = sem limite)
36+
```
37+
38+
## Autenticação
39+
- Edge on-demand (chromedp) com cache em memória + disco (0600).
40+
- Auto-perfil, fallback para perfil temporário se perfil real estiver locked (opcional).
41+
- `private.json` controla as opções (ex.: `autoProfile`, `interactiveFallback`, `allowTempProfileWhenLocked`).
42+
43+
## Instalação binários
44+
1. Vai à página da Release `v1.0.0`.
45+
2. Descarrega o arquivo para o teu SO:
46+
- `sharepoint-client_v1.0.0_windows_amd64.zip`
47+
- `sharepoint-client_v1.0.0_linux_amd64.tar.gz`
48+
- (podem existir variantes adicionais)
49+
3. Verifica checksum (`.sha256`) se desejares.
50+
4. Extrai e executa o binário `sharepoint-client`/`sharepoint-client.exe`.
51+
52+
## Verificação de integridade
53+
- Cada artefacto acompanha um ficheiro `<artefacto>.sha256` com o hash SHA-256.
54+
- No Linux/macOS:
55+
```bash
56+
shasum -a 256 sharepoint-client_v1.0.0_linux_amd64.tar.gz
57+
```
58+
- No Windows (PowerShell):
59+
```powershell
60+
Get-FileHash .\sharepoint-client_v1.0.0_windows_amd64.zip -Algorithm SHA256
61+
```
62+
63+
## Notas de compatibilidade
64+
- Requer Go 1.22+ para build local.
65+
- Edge/Chromium disponível no sistema (para o fluxo de autenticação).
66+
- O comportamento de throttling do SPO pode variar; ver `--summary`.

0 commit comments

Comments
 (0)