diff --git a/.woodpecker/build-pipeline.yml b/.woodpecker/build-pipeline.yml index 4d72d7c..0a626e2 100644 --- a/.woodpecker/build-pipeline.yml +++ b/.woodpecker/build-pipeline.yml @@ -96,19 +96,37 @@ steps: # Étape 6: Publication dans Nexus - name: publish - image: rockdrilla/woodpecker-sonatype-nexus - settings: - url: http://nexus.cicd.exygen.fr/ - auth.base64: - from_secret: YWRtaW46UGFzc3dvcmQxIQ== - upload: - - repository: domaine-passignat - paths: - - ${CI_WORKSPACE}/artifacts/${artifact} - - - - + image: *curl_image + environment: + NEXUS_USERNAME: + from_secret: nexus_username + NEXUS_PASSWORD: + from_secret: nexus_password + commands: | + source ${CI_WORKSPACE}/version.env + + if [ "$version_type" != "none" ]; then + ARTIFACT_PATH="${CI_WORKSPACE}/artifacts/${artifact}" + + echo "📦 Publication de la version ${NEW_VERSION} : ${artifact}" + + if [ ! -f "${ARTIFACT_PATH}" ]; then + echo "❌ Fichier introuvable: ${ARTIFACT_PATH}" + ls -la ${CI_WORKSPACE}/artifacts/ + exit 1 + fi + + curl -v \ + -u "${NEXUS_USERNAME}:${NEXUS_PASSWORD}" \ + -F "raw.directory=apps/${CI_REPO_NAME}/${NEW_VERSION}" \ + -F "raw.asset1=@${ARTIFACT_PATH}" \ + -F "raw.asset1.filename=${artifact}" \ + https://nexus.cicd.exygen.fr/service/rest/v1/components?repository=domaine-passignat + + echo "✅ Artefact publié" + else + echo "⏭️ Pas de publication (version_type=none)" + fi depends_on: [ package ] # Étape 7: Commit et tag (après publication)