name: Release SDSAT on: push: tags: - "v*.*.*" workflow_dispatch: jobs: release: runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 with: fetch-depth: 0 - uses: actions/setup-python@v5 with: python-version: "3.11" - name: Install deps run: | python -m pip install -U pip pip install -e ".[dev]" - name: Lint + Tests run: | ruff check . --fix pytest -q - name: Build SDSAT tar.gz with metadata (no __init__) run: | set -eux mkdir -p dist buildtmp/ # Copie uniquement le contenu de scripts/ dans buildtmp/bin cp -r scripts/. buildtmp/ # Exclure __init__.py and remove buildtmp/__pycache__ find buildtmp/ -name "__init__.py" -delete rm -R "buildtmp/__pycache__" # Metadata cat > buildtmp/BUILD_INFO.txt < /tmp/release_body.md </dev/null 2>&1 || true python -c 'import json; import pathlib; tag=pathlib.Path("/tmp/tag.txt").read_text().strip() if pathlib.Path("/tmp/tag.txt").exists() else ""' >/dev/null 2>&1 || true echo "${TAG}" > /tmp/tag.txt python -c 'import json, pathlib; tag=pathlib.Path("/tmp/tag.txt").read_text().strip(); body=pathlib.Path("/tmp/release_body.md").read_text(); print(json.dumps({"tag_name":tag,"name":tag,"body":body,"draft":False,"prerelease":False}))' \ > /tmp/release_payload.json # 4) Créer la release (si déjà existante, on continue) curl -sS -X POST "${API}/repos/${OWNER}/${REPO}/releases" \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/json" \ -d @/tmp/release_payload.json \ >/tmp/release.json || true # 5) Récupérer l'ID de la release (par tag) et uploader l'asset curl -sS "${API}/repos/${OWNER}/${REPO}/releases/tags/${TAG}" \ -H "Authorization: token ${GITEA_TOKEN}" \ >/tmp/release_get.json RID=$(python -c "import json;print(json.load(open('/tmp/release_get.json'))['id'])") ASSET="dist/SDSAT-${TAG}.tar.gz" curl -sS -X POST "${API}/repos/${OWNER}/${REPO}/releases/${RID}/assets?name=$(basename "${ASSET}")" \ -H "Authorization: token ${GITEA_TOKEN}" \ -H "Content-Type: application/gzip" \ --data-binary @"${ASSET}" \ >/dev/null