Compare commits
50 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
78cab3ffe2 | ||
|
|
f8dcae93c5 | ||
|
|
244f46418b | ||
|
|
c334f5ec09 | ||
|
|
9579676b0c | ||
|
|
10dd888152 | ||
|
|
d13bb14f34 | ||
|
|
350d3881f0 | ||
|
|
69b5c0017f | ||
|
|
08d234c8bc | ||
|
|
38a422e305 | ||
|
|
1e2cdf82e6 | ||
|
|
7c88b67418 | ||
|
|
06f135a005 | ||
|
|
8bf8e5448a | ||
|
|
564b5e9f3c | ||
|
|
ed31bcc0e3 | ||
|
|
bd17026643 | ||
|
|
68b3b81273 | ||
|
|
7eedd9549d | ||
|
|
e91c809d23 | ||
|
|
1de56405c4 | ||
|
|
0718c74966 | ||
|
|
e180afb2e3 | ||
|
|
fb305b72b3 | ||
|
|
a7bcffac98 | ||
|
|
62b401b5a1 | ||
|
|
11b254dff0 | ||
|
|
d5a0aa55d5 | ||
|
|
4b5add7403 | ||
|
|
c862b55393 | ||
|
|
bb5aebdc83 | ||
|
|
d169289cb9 | ||
|
|
ca1b8933a6 | ||
|
|
0f10a62426 | ||
|
|
ebcf40efb0 | ||
|
|
066e5565c5 | ||
|
|
91149183a2 | ||
|
|
42ce3769cd | ||
|
|
33ab64f609 | ||
|
|
e63b6c4e3f | ||
|
|
9f5f919ff9 | ||
|
|
bae02f80e2 | ||
|
|
0aa601d144 | ||
|
|
64b3ceff3f | ||
|
|
692c001e9b | ||
|
|
f6019b9b5d | ||
|
|
e4e8eadd6d | ||
|
|
a89ba6a734 | ||
|
|
e00c052ae7 |
@@ -1,8 +1,6 @@
|
|||||||
when:
|
when:
|
||||||
- event: push
|
- event: push
|
||||||
branch: [ main ]
|
branch: [ main ]
|
||||||
- event: pull_request
|
|
||||||
- event: manual
|
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
- &node_image node:18-alpine
|
- &node_image node:18-alpine
|
||||||
@@ -19,7 +17,6 @@ steps:
|
|||||||
rm -rf dist
|
rm -rf dist
|
||||||
rm -f $CI_WORKSPACE/build/version.env
|
rm -f $CI_WORKSPACE/build/version.env
|
||||||
echo "✅ Nettoyage terminé"
|
echo "✅ Nettoyage terminé"
|
||||||
|
|
||||||
depends_on: [ ]
|
depends_on: [ ]
|
||||||
|
|
||||||
# Étape 2: Analyser le message du commit
|
# Étape 2: Analyser le message du commit
|
||||||
@@ -66,15 +63,14 @@ steps:
|
|||||||
echo "ARTIFACT=no-artifact" >> $CI_WORKSPACE/version.env
|
echo "ARTIFACT=no-artifact" >> $CI_WORKSPACE/version.env
|
||||||
echo "⏭️ Pas de mise à jour de version"
|
echo "⏭️ Pas de mise à jour de version"
|
||||||
fi
|
fi
|
||||||
ls -als
|
|
||||||
depends_on: [ prepare ]
|
depends_on: [ prepare ]
|
||||||
|
|
||||||
# Étape 4: Build de l'application
|
# Étape 4: Build de l'application
|
||||||
- name: build
|
- name: build
|
||||||
image: *node_image
|
image: *node_image
|
||||||
commands: |
|
commands:
|
||||||
npm ci --cache .npm --prefer-offline
|
- npm ci --cache .npm --prefer-offline
|
||||||
npm run build
|
- npm run build
|
||||||
depends_on: [ update_version ]
|
depends_on: [ update_version ]
|
||||||
|
|
||||||
# Étape 5: Package des artefacts
|
# Étape 5: Package des artefacts
|
||||||
@@ -112,33 +108,29 @@ steps:
|
|||||||
from_secret: nexus_username
|
from_secret: nexus_username
|
||||||
NEXUS_PASSWORD:
|
NEXUS_PASSWORD:
|
||||||
from_secret: nexus_password
|
from_secret: nexus_password
|
||||||
|
NEXUS_REPOSITORY: domaine-passignat
|
||||||
commands: |
|
commands: |
|
||||||
source $CI_WORKSPACE/version.env
|
source $CI_WORKSPACE/version.env
|
||||||
echo $CI_REPO_OWNER
|
|
||||||
echo $CI_REPO_NAME
|
|
||||||
|
|
||||||
if [ "$version_type" != "none" ]; then
|
if [ "$version_type" != "none" ]; then
|
||||||
|
|
||||||
echo "📦 Publication de la version $NEW_VERSION : $ARTIFACT"
|
echo "📦 Publication de la version $NEW_VERSION : $ARTIFACT"
|
||||||
|
|
||||||
if [ ! -f "$ARTIFACT_FILE" ]; then
|
if [ ! -f "$ARTIFACT_FILE" ]; then
|
||||||
echo "❌ Fichier introuvable: $ARTIFACT_FILE"
|
echo "❌ Fichier introuvable: $ARTIFACT_FILE"
|
||||||
ls -la $ARTIFACT_FILE
|
ls -la $ARTIFACT_FILE
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -v \
|
curl -v --fail \
|
||||||
-u "$NEXUS_USERNAME:$NEXUS_PASSWORD" \
|
-u "$NEXUS_USERNAME:$NEXUS_PASSWORD" \
|
||||||
-F "raw.directory=apps/$CI_REPO_NAME/$NEW_VERSION" \
|
-F "raw.directory=apps/$CI_REPO_NAME/$NEW_VERSION" \
|
||||||
-F "raw.asset1=@$ARTIFACT_FILE" \
|
-F "raw.asset1=@$ARTIFACT_FILE" \
|
||||||
-F "raw.asset1.filename=$ARTIFACT" \
|
-F "raw.asset1.filename=$ARTIFACT" \
|
||||||
http://nexus.cicd.exygen.fr/service/rest/v1/components?repository=domaine-passignat
|
http://nexus.cicd.exygen.fr/service/rest/v1/components?repository=$NEXUS_REPOSITORY
|
||||||
|
|
||||||
echo "✅ Artefact publié"
|
echo "✅ Artefact publié"
|
||||||
else
|
else
|
||||||
echo "⏭️ Pas de publication (version_type=none)"
|
echo "⏭️ Pas de publication (version_type=none)"
|
||||||
fi
|
fi
|
||||||
ls -als
|
|
||||||
depends_on: [ package ]
|
depends_on: [ package ]
|
||||||
|
|
||||||
# Étape 7: Commit et tag (après publication)
|
# Étape 7: Commit et tag (après publication)
|
||||||
@@ -184,11 +176,12 @@ steps:
|
|||||||
from_secret: woodpecker_token
|
from_secret: woodpecker_token
|
||||||
commands: |
|
commands: |
|
||||||
source $CI_WORKSPACE/version.env
|
source $CI_WORKSPACE/version.env
|
||||||
|
|
||||||
if [ "$version_type" != "none" ]; then
|
if [ "$version_type" != "none" ]; then
|
||||||
echo "🚀 Déclenchement du déploiement pour la version $NEW_VERSION"
|
echo "🚀 Déclenchement du déploiement pour la version $NEW_VERSION"
|
||||||
|
echo "🚀 $CI_REPO_OWNER"
|
||||||
curl -X POST \
|
echo "🚀 $CI_REPO_NAME"
|
||||||
|
echo "http://woodpecker.cicd.exygen.fr/api/repos/$CI_REPO_OWNER/$CI_REPO_NAME/pipelines"
|
||||||
|
curl -v --fail -X POST \
|
||||||
"http://woodpecker.cicd.exygen.fr/api/repos/$CI_REPO_OWNER/$CI_REPO_NAME/pipelines" \
|
"http://woodpecker.cicd.exygen.fr/api/repos/$CI_REPO_OWNER/$CI_REPO_NAME/pipelines" \
|
||||||
-H "Authorization: Bearer $WOODPECKER_TOKEN" \
|
-H "Authorization: Bearer $WOODPECKER_TOKEN" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
@@ -199,9 +192,35 @@ steps:
|
|||||||
"deploy_id": "'$CI_PIPELINE_NUMBER'",
|
"deploy_id": "'$CI_PIPELINE_NUMBER'",
|
||||||
"ref": "refs/tags/v'$NEW_VERSION'"
|
"ref": "refs/tags/v'$NEW_VERSION'"
|
||||||
}'
|
}'
|
||||||
|
|
||||||
echo "✅ Événement deployment déclenché"
|
echo "✅ Événement deployment déclenché"
|
||||||
else
|
else
|
||||||
echo "⏭️ Pas de déclenchement (version_type=none)"
|
echo "⏭️ Pas de déclenchement (version_type=none)"
|
||||||
fi
|
fi
|
||||||
depends_on: [ commit_tag ]
|
depends_on: [ commit_tag ]
|
||||||
|
when:
|
||||||
|
- event: never
|
||||||
|
|
||||||
|
|
||||||
|
- name: trigger-deployment2
|
||||||
|
image: woodpeckerci/plugin-trigger
|
||||||
|
settings:
|
||||||
|
# L'URL de votre serveur Woodpecker
|
||||||
|
server: https://woodpecker.cicd.exygen.fr
|
||||||
|
# Le token d'API (doit être stocké comme secret)
|
||||||
|
branche: main
|
||||||
|
deploy_pipeline: ${CI_PIPELINE_NUMBER}
|
||||||
|
token:
|
||||||
|
from_secret: woodpecker_token
|
||||||
|
# Le dépôt cible, avec la branche optionnelle (format propriétaire/répertoire[@branche])
|
||||||
|
repo: domaine-passignat/gestion
|
||||||
|
# Paramètre CLÉ : active l'événement 'deployment' et spécifie l'environnement cible
|
||||||
|
deploy_to: production
|
||||||
|
# (Optionnel) Transmettre des variables au pipeline déclenché (ex: une version)
|
||||||
|
params:
|
||||||
|
- VERSION=${NEW_VERSION}
|
||||||
|
# (Optionnel) Attendre la fin du pipeline déclenché
|
||||||
|
wait: true
|
||||||
|
# Déclenche cette étape uniquement après une publication réussie
|
||||||
|
depends_on: [ commit_tag ]
|
||||||
|
when:
|
||||||
|
- event: never
|
||||||
|
|||||||
10
.woodpecker/test.yml
Normal file
10
.woodpecker/test.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
when:
|
||||||
|
- event: [ push, deployment, manual ]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: test
|
||||||
|
image: alpine
|
||||||
|
commands: |
|
||||||
|
echo "Pipeline déclenché !"
|
||||||
|
echo "Event: ${CI_PIPELINE_EVENT}"
|
||||||
|
echo "Deploy to: ${CI_PIPELINE_DEPLOY_TARGET}"
|
||||||
1
database/src/sql/version-0.0.10-0.0.11.sql
Normal file
1
database/src/sql/version-0.0.10-0.0.11.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- none
|
||||||
1
database/src/sql/version-0.0.11-0.0.12.sql
Normal file
1
database/src/sql/version-0.0.11-0.0.12.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- none
|
||||||
1
database/src/sql/version-0.0.12-0.0.13.sql
Normal file
1
database/src/sql/version-0.0.12-0.0.13.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- none
|
||||||
1
database/src/sql/version-0.0.13-0.0.14.sql
Normal file
1
database/src/sql/version-0.0.13-0.0.14.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- none
|
||||||
1
database/src/sql/version-0.0.14-0.0.15.sql
Normal file
1
database/src/sql/version-0.0.14-0.0.15.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- none
|
||||||
1
database/src/sql/version-0.0.15-0.0.16.sql
Normal file
1
database/src/sql/version-0.0.15-0.0.16.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- none
|
||||||
1
database/src/sql/version-0.0.16-0.0.17.sql
Normal file
1
database/src/sql/version-0.0.16-0.0.17.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- none
|
||||||
1
database/src/sql/version-0.0.17-0.0.18.sql
Normal file
1
database/src/sql/version-0.0.17-0.0.18.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- none
|
||||||
1
database/src/sql/version-0.0.5-0.0.6.sql
Normal file
1
database/src/sql/version-0.0.5-0.0.6.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- none
|
||||||
1
database/src/sql/version-0.0.6-0.0.7.sql
Normal file
1
database/src/sql/version-0.0.6-0.0.7.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- none
|
||||||
1
database/src/sql/version-0.0.7-0.0.8.sql
Normal file
1
database/src/sql/version-0.0.7-0.0.8.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- none
|
||||||
1
database/src/sql/version-0.0.8-0.0.9.sql
Normal file
1
database/src/sql/version-0.0.8-0.0.9.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- none
|
||||||
1
database/src/sql/version-0.0.9-0.0.10.sql
Normal file
1
database/src/sql/version-0.0.9-0.0.10.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
-- none
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "cicd",
|
"name": "cicd",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.5",
|
"version": "0.0.18",
|
||||||
"description": "Node.js Rest Apis with Express, Sequelize & PostgreSQL",
|
"description": "Node.js Rest Apis with Express, Sequelize & PostgreSQL",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"update:patch": "node scripts/update-version.js -patch",
|
"update:patch": "node scripts/update-version.js -patch",
|
||||||
|
|||||||
Reference in New Issue
Block a user