From 3b20dfd9aeab8d5a17460973112e52f28906415f Mon Sep 17 00:00:00 2001 From: Debian Date: Wed, 27 Aug 2025 23:52:38 +0000 Subject: [PATCH] add some files --- .gitea/workflows/ci.yml | 32 ++++++++++++++++++++++++ docs/GITEA_SETUP.md | 8 ++++-- tests/connectivity/test_storage_proxy.sh | 2 -- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 9193d5ab..0dba3c95 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -3,6 +3,8 @@ name: CI - 4NK_node on: push: branches: [ main, develop ] + tags: + - v* pull_request: branches: [ main, develop ] @@ -360,3 +362,33 @@ jobs: run: | echo "❌ Some tests failed!" exit 1 + + publish-release: + name: Publish Release + runs-on: ubuntu-latest + needs: [release-guard] + if: startsWith(github.ref, 'refs/tags/') + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Create Gitea release + env: + TOKEN: ${{ secrets.RELEASE_TOKEN }} + TAG_REF: ${{ github.ref }} + API: https://git.4nkweb.com/api/v1/repos/4nk/4NK_node + run: | + set -e + if [ -z "$TOKEN" ]; then + echo "Missing RELEASE_TOKEN secret" >&2 + exit 1 + fi + TAG="${TAG_REF##*/}" + STATUS=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG") + if [ "$STATUS" != "200" ]; then + BODY="Release ${TAG} - voir CHANGELOG.md" + curl -s -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \ + -X POST "$API/releases" \ + -d "{\"tag_name\":\"$TAG\",\"target_commitish\":\"main\",\"name\":\"$TAG\",\"body\":\"$BODY\",\"draft\":false,\"prerelease\":false}" + fi + curl -s -H "Authorization: token $TOKEN" "$API/releases/tags/$TAG" >/dev/null diff --git a/docs/GITEA_SETUP.md b/docs/GITEA_SETUP.md index 746716bd..6d182a61 100644 --- a/docs/GITEA_SETUP.md +++ b/docs/GITEA_SETUP.md @@ -89,6 +89,12 @@ pipeline { } ``` +#### Publication automatique des releases + +- Définir un secret de repository nommé `RELEASE_TOKEN` (scope: write:repository) dans Gitea. +- Le workflow `.gitea/workflows/ci.yml` publie automatiquement une release lors d’un push de tag `v*` en utilisant ce secret. +- Le corps de la release référence `CHANGELOG.md`. Pour des notes plus détaillées, mettez à jour le changelog avant de créer le tag. + ### Option 3 : GitHub Actions (Migration) Si vous souhaitez utiliser GitHub Actions avec un miroir : @@ -277,5 +283,3 @@ events: --- **Configuration Gitea terminée ! Le projet est prêt pour l'open source sur git.4nkweb.com** 🚀 - - diff --git a/tests/connectivity/test_storage_proxy.sh b/tests/connectivity/test_storage_proxy.sh index c23ff54d..a04f63f4 100755 --- a/tests/connectivity/test_storage_proxy.sh +++ b/tests/connectivity/test_storage_proxy.sh @@ -46,5 +46,3 @@ echo "$resp_get" | grep -q "\"value\":\"${val_hex}\"" || fail "valeur inattendue log "Succès: /storage opérationnel via reverse proxy" exit 0 - -