This commit is contained in:
59
.gitea/workflows/release.yml
Normal file
59
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
name: Release SDSAT
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*.*.*"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.11"
|
||||||
|
|
||||||
|
- name: Install deps
|
||||||
|
run: |
|
||||||
|
python -m pip install -U pip
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pip install -r requirements-dev.txt
|
||||||
|
|
||||||
|
- name: Lint + Tests
|
||||||
|
run: |
|
||||||
|
ruff check .
|
||||||
|
pytest -q
|
||||||
|
|
||||||
|
- name: Build release package
|
||||||
|
run: |
|
||||||
|
mkdir -p dist
|
||||||
|
zip -r dist/SDSAT-${{ gitea.ref_name }}.zip scripts pyproject.toml requirements.txt
|
||||||
|
|
||||||
|
# Crée une release Gitea + upload l'asset
|
||||||
|
- name: Create Gitea release (and upload asset)
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
OWNER: ${{ gitea.repository_owner }}
|
||||||
|
REPO: ${{ gitea.event.repository.name }}
|
||||||
|
TAG: ${{ gitea.ref_name }}
|
||||||
|
GITEA_SERVER_URL: ${{ gitea.server_url }}
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
API="${GITEA_SERVER_URL}/api/v1"
|
||||||
|
# create release
|
||||||
|
curl -sS -X POST "${API}/repos/${OWNER}/${REPO}/releases" \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"tag_name\":\"${TAG}\",\"name\":\"${TAG}\",\"draft\":false,\"prerelease\":false}" \
|
||||||
|
>/tmp/release.json
|
||||||
|
|
||||||
|
RID=$(python -c "import json;print(json.load(open('/tmp/release.json'))['id'])")
|
||||||
|
|
||||||
|
# upload asset
|
||||||
|
curl -sS -X POST "${API}/repos/${OWNER}/${REPO}/releases/${RID}/assets?name=SDSAT-${TAG}.zip" \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
-H "Content-Type: application/zip" \
|
||||||
|
--data-binary @dist/SDSAT-${TAG}.zip \
|
||||||
|
>/dev/null
|
||||||
Reference in New Issue
Block a user