diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index aa937d6..a2410ea 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -1,9 +1,10 @@ -name: Release +name: Release SDSAT on: push: tags: - "v*.*.*" + workflow_dispatch: jobs: release: @@ -15,67 +16,71 @@ jobs: with: python-version: "3.11" - - name: Install tooling + - name: Install deps run: | python -m pip install -U pip - pip install ruff pytest requests + pip install -e ".[dev]" - - name: Lint + tests + - name: Lint + Tests run: | - ruff check . --fix + ruff check . pytest -q - - name: Build SDSAT tar.gz + - name: Build SDSAT tar.gz with metadata (no __init__) run: | - - mkdir -p dist buildtmp + set -eux - # Copie uniquement les scripts dans buildtmp - cp -r scripts/* buildtmp/ + mkdir -p dist buildtmp/{bin,logs,update} - # Supprime __init__.py - find buildtmp/ -name "__init__.py" -delete + # Copie uniquement le contenu de scripts/ dans buildtmp/bin + cp -r scripts/. buildtmp/bin/ - # Génère le fichier de metadata - cat > buildtmp/BUILD_INFO.txt < buildtmp/update/BUILD_INFO.txt </tmp/release_create.json || true - # Get release by tag + # Récupère l'id de la release par tag (fiable) 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}.zip" + ASSET="dist/SDSAT-${TAG}.tar.gz" + ls -la "${ASSET}" - curl -sS -X POST "${API}/repos/${OWNER}/${REPO}/releases/${RID}/assets?name=$(basename ${ASSET})" \ + curl -sS -X POST "${API}/repos/${OWNER}/${REPO}/releases/${RID}/assets?name=$(basename "${ASSET}")" \ -H "Authorization: token ${GITEA_TOKEN}" \ - -H "Content-Type: application/zip" \ + -H "Content-Type: application/gzip" \ --data-binary @"${ASSET}" \ >/dev/null