@lystech/core 3.0.49 → 3.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,189 +1,189 @@
1
1
  #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
-
6
- const WORKFLOW_CONTENT = `name: Sync Package Registry
7
-
8
- on:
9
- push:
10
- branches:
11
- - master
12
- - main
13
- workflow_dispatch:
14
-
15
- jobs:
16
- sync-registry:
17
- runs-on: ubuntu-latest
18
-
19
- steps:
20
- - name: Checkout
21
- uses: actions/checkout@v4
22
-
23
- - name: Check package.json for @lystech/core
24
- id: check-package
25
- run: |
26
- echo "🔍 Vérification de package.json..."
27
-
28
- # Extraire owner et repo depuis GITHUB_REPOSITORY (format: owner/repo)
29
- OWNER="\${GITHUB_REPOSITORY%%/*}"
30
- REPO_NAME="\${GITHUB_REPOSITORY#*/}"
31
-
32
- echo "owner=$OWNER" >> "$GITHUB_OUTPUT"
33
- echo "repo_name=$REPO_NAME" >> "$GITHUB_OUTPUT"
34
- echo "📦 Repo: $OWNER/$REPO_NAME"
35
-
36
- # Récupérer le repoId depuis l'API GitHub
37
- REPO_ID=$(curl -s -H "Authorization: token \${{ secrets.GITHUB_TOKEN }}" \\
38
- "https://api.github.com/repos/$OWNER/$REPO_NAME" | jq -r '.id')
39
-
40
- echo "repo_id=$REPO_ID" >> "$GITHUB_OUTPUT"
41
- echo "🆔 Repo ID: $REPO_ID"
42
-
43
- # Vérifier que REPO_ID est valide (non vide et non null)
44
- if [ -z "$REPO_ID" ] || [ "$REPO_ID" = "null" ]; then
45
- echo "❌ Erreur: Impossible de récupérer le repo ID"
46
- exit 1
47
- fi
48
-
49
- # Vérifier si @lystech/core est dans les dépendances
50
- HAS_PACKAGE=$(node -e "
51
- const pkg = require('./package.json');
52
- const hasIt = !!(
53
- (pkg.dependencies && pkg.dependencies['@lystech/core']) ||
54
- (pkg.devDependencies && pkg.devDependencies['@lystech/core']) ||
55
- (pkg.peerDependencies && pkg.peerDependencies['@lystech/core'])
56
- );
57
- console.log(hasIt ? 'true' : 'false');
58
- " 2>/dev/null || echo "false")
59
-
60
- echo "has_package=$HAS_PACKAGE" >> "$GITHUB_OUTPUT"
61
-
62
- if [ "$HAS_PACKAGE" = "true" ]; then
63
- echo "✅ Package @lystech/core trouvé dans les dépendances"
64
- else
65
- echo "❌ Package @lystech/core non trouvé"
66
- fi
67
-
68
- - name: Register in Package Registry
69
- if: steps.check-package.outputs.has_package == 'true'
70
- run: |
71
- echo "📝 Enregistrement dans le Package Registry..."
72
-
73
- # Construire le payload JSON
74
- PAYLOAD=$(jq -n \\
75
- --arg packageName "@lystech/core" \\
76
- --arg owner "\${{ steps.check-package.outputs.owner }}" \\
77
- --arg repo "\${{ steps.check-package.outputs.repo_name }}" \\
78
- --argjson repoId "\${{ steps.check-package.outputs.repo_id }}" \\
79
- '{packageName: $packageName, owner: $owner, repo: $repo, repoId: $repoId}')
80
-
81
- echo "📤 Payload envoyé:"
82
- echo "$PAYLOAD" | jq '.'
83
-
84
- RESPONSE=$(curl -s -X POST \\
85
- -H "Content-Type: application/json" \\
86
- -d "$PAYLOAD" \\
87
- https://lysbunback-usgg4.ondigitalocean.app/api/package-registry)
88
-
89
- echo "Réponse API:"
90
- echo "$RESPONSE" | jq '.'
91
-
92
- SUCCESS=$(echo "$RESPONSE" | jq -r '.success')
93
-
94
- if [ "$SUCCESS" = "true" ]; then
95
- echo "✅ Enregistré avec succès dans le registry"
96
- else
97
- echo "⚠️ L'enregistrement a échoué (peut-être déjà enregistré)"
98
- fi
99
-
100
- - name: Remove from Package Registry
101
- if: steps.check-package.outputs.has_package == 'false'
102
- run: |
103
- echo "🗑️ Suppression du Package Registry..."
104
-
105
- PACKAGE_NAME="@lystech/core"
106
- ENCODED_NAME=$(echo "$PACKAGE_NAME" | jq -sRr @uri)
107
-
108
- RESPONSE=$(curl -s -X DELETE \\
109
- "https://lysbunback-usgg4.ondigitalocean.app/api/package-registry/$ENCODED_NAME/\${{ steps.check-package.outputs.owner }}/\${{ steps.check-package.outputs.repo_name }}")
110
-
111
- echo "Réponse API:"
112
- echo "$RESPONSE" | jq '.'
113
-
114
- SUCCESS=$(echo "$RESPONSE" | jq -r '.success')
115
-
116
- if [ "$SUCCESS" = "true" ]; then
117
- echo "✅ Supprimé avec succès du registry"
118
- else
119
- echo "⚠️ La suppression a échoué (peut-être déjà supprimé)"
120
- fi
121
-
122
- - name: Summary
123
- if: always()
124
- run: |
125
- echo "### 📊 Résumé Sync Registry" >> $GITHUB_STEP_SUMMARY
126
- echo "" >> $GITHUB_STEP_SUMMARY
127
- echo "**Repo:** \${{ steps.check-package.outputs.owner }}/\${{ steps.check-package.outputs.repo_name }}" >> $GITHUB_STEP_SUMMARY
128
- echo "**Package @lystech/core:** \${{ steps.check-package.outputs.has_package == 'true' && '✅ Présent' || '❌ Absent' }}" >> $GITHUB_STEP_SUMMARY
129
- echo "" >> $GITHUB_STEP_SUMMARY
130
- if [ "\${{ steps.check-package.outputs.has_package }}" = "true" ]; then
131
- echo "**Action:** Enregistré dans le registry" >> $GITHUB_STEP_SUMMARY
132
- else
133
- echo "**Action:** Supprimé du registry" >> $GITHUB_STEP_SUMMARY
134
- fi
135
- `;
136
-
137
- function main() {
138
- console.log('🚀 Configuration de @lystech/core Package Registry Auto-Sync...\n');
139
-
140
- // Trouver le répertoire racine du projet (où est package.json)
141
- let currentDir = process.cwd();
142
- let projectRoot = currentDir;
143
-
144
- // Chercher package.json en remontant
145
- while (!fs.existsSync(path.join(projectRoot, 'package.json'))) {
146
- const parent = path.dirname(projectRoot);
147
- if (parent === projectRoot) {
148
- console.error('❌ Erreur: package.json non trouvé. Exécutez cette commande à la racine de votre projet.');
149
- process.exit(1);
150
- }
151
- projectRoot = parent;
152
- }
153
-
154
- console.log(`📁 Projet détecté: ${projectRoot}\n`);
155
-
156
- // Créer le dossier .github/workflows s'il n'existe pas
157
- const workflowDir = path.join(projectRoot, '.github', 'workflows');
158
- if (!fs.existsSync(workflowDir)) {
159
- console.log('📂 Création du dossier .github/workflows...');
160
- fs.mkdirSync(workflowDir, { recursive: true });
161
- }
162
-
163
- // Créer le fichier workflow
164
- const workflowPath = path.join(workflowDir, 'sync-package-registry.yml');
165
-
166
- if (fs.existsSync(workflowPath)) {
167
- console.log('⚠️ Le fichier sync-package-registry.yml existe déjà.');
168
- console.log(' Pour le remplacer, supprimez-le d\'abord ou utilisez --force\n');
169
-
170
- if (!process.argv.includes('--force')) {
171
- console.log('✅ Aucune action nécessaire.');
172
- process.exit(0);
173
- }
174
-
175
- console.log('🔄 Remplacement du fichier existant (--force)...');
176
- }
177
-
178
- fs.writeFileSync(workflowPath, WORKFLOW_CONTENT, 'utf8');
179
-
180
- console.log('✅ Workflow créé avec succès!\n');
181
- console.log('📄 Fichier créé: .github/workflows/sync-package-registry.yml\n');
182
- console.log('📋 Prochaines étapes:');
183
- console.log(' 1. Commitez le workflow: git add .github/workflows/sync-package-registry.yml');
184
- console.log(' 2. Pushez sur GitHub: git commit -m "feat: add package registry auto-sync" && git push');
185
- console.log(' 3. Le workflow s\'enregistrera automatiquement dans le registry\n');
186
- console.log('🎉 Votre projet recevra maintenant les mises à jour automatiques de @lystech/core!');
187
- }
188
-
189
- main();
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ const WORKFLOW_CONTENT = `name: Sync Package Registry
7
+
8
+ on:
9
+ push:
10
+ branches:
11
+ - master
12
+ - main
13
+ workflow_dispatch:
14
+
15
+ jobs:
16
+ sync-registry:
17
+ runs-on: ubuntu-latest
18
+
19
+ steps:
20
+ - name: Checkout
21
+ uses: actions/checkout@v4
22
+
23
+ - name: Check package.json for @lystech/core
24
+ id: check-package
25
+ run: |
26
+ echo "🔍 Vérification de package.json..."
27
+
28
+ # Extraire owner et repo depuis GITHUB_REPOSITORY (format: owner/repo)
29
+ OWNER="\${GITHUB_REPOSITORY%%/*}"
30
+ REPO_NAME="\${GITHUB_REPOSITORY#*/}"
31
+
32
+ echo "owner=$OWNER" >> "$GITHUB_OUTPUT"
33
+ echo "repo_name=$REPO_NAME" >> "$GITHUB_OUTPUT"
34
+ echo "📦 Repo: $OWNER/$REPO_NAME"
35
+
36
+ # Récupérer le repoId depuis l'API GitHub
37
+ REPO_ID=$(curl -s -H "Authorization: token \${{ secrets.GITHUB_TOKEN }}" \\
38
+ "https://api.github.com/repos/$OWNER/$REPO_NAME" | jq -r '.id')
39
+
40
+ echo "repo_id=$REPO_ID" >> "$GITHUB_OUTPUT"
41
+ echo "🆔 Repo ID: $REPO_ID"
42
+
43
+ # Vérifier que REPO_ID est valide (non vide et non null)
44
+ if [ -z "$REPO_ID" ] || [ "$REPO_ID" = "null" ]; then
45
+ echo "❌ Erreur: Impossible de récupérer le repo ID"
46
+ exit 1
47
+ fi
48
+
49
+ # Vérifier si @lystech/core est dans les dépendances
50
+ HAS_PACKAGE=$(node -e "
51
+ const pkg = require('./package.json');
52
+ const hasIt = !!(
53
+ (pkg.dependencies && pkg.dependencies['@lystech/core']) ||
54
+ (pkg.devDependencies && pkg.devDependencies['@lystech/core']) ||
55
+ (pkg.peerDependencies && pkg.peerDependencies['@lystech/core'])
56
+ );
57
+ console.log(hasIt ? 'true' : 'false');
58
+ " 2>/dev/null || echo "false")
59
+
60
+ echo "has_package=$HAS_PACKAGE" >> "$GITHUB_OUTPUT"
61
+
62
+ if [ "$HAS_PACKAGE" = "true" ]; then
63
+ echo "✅ Package @lystech/core trouvé dans les dépendances"
64
+ else
65
+ echo "❌ Package @lystech/core non trouvé"
66
+ fi
67
+
68
+ - name: Register in Package Registry
69
+ if: steps.check-package.outputs.has_package == 'true'
70
+ run: |
71
+ echo "📝 Enregistrement dans le Package Registry..."
72
+
73
+ # Construire le payload JSON
74
+ PAYLOAD=$(jq -n \\
75
+ --arg packageName "@lystech/core" \\
76
+ --arg owner "\${{ steps.check-package.outputs.owner }}" \\
77
+ --arg repo "\${{ steps.check-package.outputs.repo_name }}" \\
78
+ --argjson repoId "\${{ steps.check-package.outputs.repo_id }}" \\
79
+ '{packageName: $packageName, owner: $owner, repo: $repo, repoId: $repoId}')
80
+
81
+ echo "📤 Payload envoyé:"
82
+ echo "$PAYLOAD" | jq '.'
83
+
84
+ RESPONSE=$(curl -s -X POST \\
85
+ -H "Content-Type: application/json" \\
86
+ -d "$PAYLOAD" \\
87
+ https://lysbunback-usgg4.ondigitalocean.app/api/package-registry)
88
+
89
+ echo "Réponse API:"
90
+ echo "$RESPONSE" | jq '.'
91
+
92
+ SUCCESS=$(echo "$RESPONSE" | jq -r '.success')
93
+
94
+ if [ "$SUCCESS" = "true" ]; then
95
+ echo "✅ Enregistré avec succès dans le registry"
96
+ else
97
+ echo "⚠️ L'enregistrement a échoué (peut-être déjà enregistré)"
98
+ fi
99
+
100
+ - name: Remove from Package Registry
101
+ if: steps.check-package.outputs.has_package == 'false'
102
+ run: |
103
+ echo "🗑️ Suppression du Package Registry..."
104
+
105
+ PACKAGE_NAME="@lystech/core"
106
+ ENCODED_NAME=$(echo "$PACKAGE_NAME" | jq -sRr @uri)
107
+
108
+ RESPONSE=$(curl -s -X DELETE \\
109
+ "https://lysbunback-usgg4.ondigitalocean.app/api/package-registry/$ENCODED_NAME/\${{ steps.check-package.outputs.owner }}/\${{ steps.check-package.outputs.repo_name }}")
110
+
111
+ echo "Réponse API:"
112
+ echo "$RESPONSE" | jq '.'
113
+
114
+ SUCCESS=$(echo "$RESPONSE" | jq -r '.success')
115
+
116
+ if [ "$SUCCESS" = "true" ]; then
117
+ echo "✅ Supprimé avec succès du registry"
118
+ else
119
+ echo "⚠️ La suppression a échoué (peut-être déjà supprimé)"
120
+ fi
121
+
122
+ - name: Summary
123
+ if: always()
124
+ run: |
125
+ echo "### 📊 Résumé Sync Registry" >> $GITHUB_STEP_SUMMARY
126
+ echo "" >> $GITHUB_STEP_SUMMARY
127
+ echo "**Repo:** \${{ steps.check-package.outputs.owner }}/\${{ steps.check-package.outputs.repo_name }}" >> $GITHUB_STEP_SUMMARY
128
+ echo "**Package @lystech/core:** \${{ steps.check-package.outputs.has_package == 'true' && '✅ Présent' || '❌ Absent' }}" >> $GITHUB_STEP_SUMMARY
129
+ echo "" >> $GITHUB_STEP_SUMMARY
130
+ if [ "\${{ steps.check-package.outputs.has_package }}" = "true" ]; then
131
+ echo "**Action:** Enregistré dans le registry" >> $GITHUB_STEP_SUMMARY
132
+ else
133
+ echo "**Action:** Supprimé du registry" >> $GITHUB_STEP_SUMMARY
134
+ fi
135
+ `;
136
+
137
+ function main() {
138
+ console.log('🚀 Configuration de @lystech/core Package Registry Auto-Sync...\n');
139
+
140
+ // Trouver le répertoire racine du projet (où est package.json)
141
+ let currentDir = process.cwd();
142
+ let projectRoot = currentDir;
143
+
144
+ // Chercher package.json en remontant
145
+ while (!fs.existsSync(path.join(projectRoot, 'package.json'))) {
146
+ const parent = path.dirname(projectRoot);
147
+ if (parent === projectRoot) {
148
+ console.error('❌ Erreur: package.json non trouvé. Exécutez cette commande à la racine de votre projet.');
149
+ process.exit(1);
150
+ }
151
+ projectRoot = parent;
152
+ }
153
+
154
+ console.log(`📁 Projet détecté: ${projectRoot}\n`);
155
+
156
+ // Créer le dossier .github/workflows s'il n'existe pas
157
+ const workflowDir = path.join(projectRoot, '.github', 'workflows');
158
+ if (!fs.existsSync(workflowDir)) {
159
+ console.log('📂 Création du dossier .github/workflows...');
160
+ fs.mkdirSync(workflowDir, { recursive: true });
161
+ }
162
+
163
+ // Créer le fichier workflow
164
+ const workflowPath = path.join(workflowDir, 'sync-package-registry.yml');
165
+
166
+ if (fs.existsSync(workflowPath)) {
167
+ console.log('⚠️ Le fichier sync-package-registry.yml existe déjà.');
168
+ console.log(' Pour le remplacer, supprimez-le d\'abord ou utilisez --force\n');
169
+
170
+ if (!process.argv.includes('--force')) {
171
+ console.log('✅ Aucune action nécessaire.');
172
+ process.exit(0);
173
+ }
174
+
175
+ console.log('🔄 Remplacement du fichier existant (--force)...');
176
+ }
177
+
178
+ fs.writeFileSync(workflowPath, WORKFLOW_CONTENT, 'utf8');
179
+
180
+ console.log('✅ Workflow créé avec succès!\n');
181
+ console.log('📄 Fichier créé: .github/workflows/sync-package-registry.yml\n');
182
+ console.log('📋 Prochaines étapes:');
183
+ console.log(' 1. Commitez le workflow: git add .github/workflows/sync-package-registry.yml');
184
+ console.log(' 2. Pushez sur GitHub: git commit -m "feat: add package registry auto-sync" && git push');
185
+ console.log(' 3. Le workflow s\'enregistrera automatiquement dans le registry\n');
186
+ console.log('🎉 Votre projet recevra maintenant les mises à jour automatiques de @lystech/core!');
187
+ }
188
+
189
+ main();
@@ -1,114 +1,114 @@
1
- name: Update Lystech Package
2
-
3
- on:
4
- workflow_dispatch:
5
- inputs:
6
- package_name:
7
- description: "Package name (ex: @lystech/core)"
8
- required: true
9
- type: string
10
- version:
11
- description: "Version to update to (ex: 3.0.18)"
12
- required: true
13
- type: string
14
-
15
- permissions:
16
- contents: write
17
-
18
- jobs:
19
- update-package:
20
- runs-on: ubuntu-latest
21
-
22
- steps:
23
- - name: Checkout
24
- uses: actions/checkout@v4
25
-
26
- - name: Setup Node
27
- uses: actions/setup-node@v4
28
- with:
29
- node-version: 20
30
- cache: "npm"
31
-
32
- - name: Configure Git
33
- run: |
34
- git config user.name "github-actions[bot]"
35
- git config user.email "github-actions[bot]@users.noreply.github.com"
36
-
37
- - name: Install dependencies
38
- run: npm ci
39
-
40
- - name: Install Firebase CLI
41
- run: npm install -g firebase-tools
42
-
43
- - name: Check current version
44
- id: check-version
45
- run: |
46
- CURRENT_VERSION=$(node -p "require('./package.json').dependencies['${{ github.event.inputs.package_name }}'] || require('./package.json').devDependencies['${{ github.event.inputs.package_name }}'] || 'not-found'")
47
- echo "Current version: $CURRENT_VERSION"
48
- echo "Target version: ${{ github.event.inputs.version }}"
49
- echo "current=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
50
-
51
- - name: Update package
52
- run: |
53
- echo "📦 Mise à jour de ${{ github.event.inputs.package_name }} vers ${{ github.event.inputs.version }}"
54
- npm install ${{ github.event.inputs.package_name }}@${{ github.event.inputs.version }}
55
-
56
- - name: Check if deploy script exists
57
- id: check-deploy
58
- run: |
59
- if grep -q '"deploy"' package.json; then
60
- echo "has_deploy=true" >> "$GITHUB_OUTPUT"
61
- echo "✅ Script 'deploy' trouvé"
62
- else
63
- echo "has_deploy=false" >> "$GITHUB_OUTPUT"
64
- echo "⏭️ Pas de script 'deploy'"
65
- fi
66
-
67
- - name: Run deploy
68
- if: steps.check-deploy.outputs.has_deploy == 'true'
69
- continue-on-error: true
70
- id: deploy
71
- env:
72
- FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
73
- FIREBASE_SA_KEY: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }}
74
- run: |
75
- # Utiliser service account si disponible, sinon token
76
- if [ -n "$FIREBASE_SA_KEY" ]; then
77
- echo "🔑 Utilisation du service account Firebase..."
78
- echo "$FIREBASE_SA_KEY" > $HOME/firebase-sa.json
79
- export GOOGLE_APPLICATION_CREDENTIALS=$HOME/firebase-sa.json
80
- fi
81
-
82
- echo "🚀 Déploiement..."
83
- npm run deploy
84
-
85
- - name: Commit and push changes
86
- run: |
87
- git add package.json package-lock.json
88
-
89
- if git diff --staged --quiet; then
90
- echo "⏭️ Aucun changement à committer"
91
- else
92
- git commit -m "chore: update ${{ github.event.inputs.package_name }} to ${{ github.event.inputs.version }} [skip ci]"
93
- git push
94
- echo "✅ Changements committes et pushés"
95
- fi
96
-
97
- - name: Summary
98
- if: always()
99
- run: |
100
- echo "### 📦 Mise à jour Package" >> $GITHUB_STEP_SUMMARY
101
- echo "" >> $GITHUB_STEP_SUMMARY
102
- echo "**Package:** ${{ github.event.inputs.package_name }}" >> $GITHUB_STEP_SUMMARY
103
- echo "**Ancienne version:** ${{ steps.check-version.outputs.current }}" >> $GITHUB_STEP_SUMMARY
104
- echo "**Nouvelle version:** ${{ github.event.inputs.version }}" >> $GITHUB_STEP_SUMMARY
105
-
106
- if [ "${{ steps.check-deploy.outputs.has_deploy }}" = "true" ]; then
107
- if [ "${{ steps.deploy.outcome }}" = "success" ]; then
108
- echo "**Déploiement:** ✅ Réussi" >> $GITHUB_STEP_SUMMARY
109
- else
110
- echo "**Déploiement:** ❌ Échoué (package mis à jour quand même)" >> $GITHUB_STEP_SUMMARY
111
- fi
112
- else
113
- echo "**Déploiement:** ⏭️ Ignoré" >> $GITHUB_STEP_SUMMARY
114
- fi
1
+ name: Update Lystech Package
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ package_name:
7
+ description: "Package name (ex: @lystech/core)"
8
+ required: true
9
+ type: string
10
+ version:
11
+ description: "Version to update to (ex: 3.0.18)"
12
+ required: true
13
+ type: string
14
+
15
+ permissions:
16
+ contents: write
17
+
18
+ jobs:
19
+ update-package:
20
+ runs-on: ubuntu-latest
21
+
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Setup Node
27
+ uses: actions/setup-node@v4
28
+ with:
29
+ node-version: 20
30
+ cache: "npm"
31
+
32
+ - name: Configure Git
33
+ run: |
34
+ git config user.name "github-actions[bot]"
35
+ git config user.email "github-actions[bot]@users.noreply.github.com"
36
+
37
+ - name: Install dependencies
38
+ run: npm ci
39
+
40
+ - name: Install Firebase CLI
41
+ run: npm install -g firebase-tools
42
+
43
+ - name: Check current version
44
+ id: check-version
45
+ run: |
46
+ CURRENT_VERSION=$(node -p "require('./package.json').dependencies['${{ github.event.inputs.package_name }}'] || require('./package.json').devDependencies['${{ github.event.inputs.package_name }}'] || 'not-found'")
47
+ echo "Current version: $CURRENT_VERSION"
48
+ echo "Target version: ${{ github.event.inputs.version }}"
49
+ echo "current=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"
50
+
51
+ - name: Update package
52
+ run: |
53
+ echo "📦 Mise à jour de ${{ github.event.inputs.package_name }} vers ${{ github.event.inputs.version }}"
54
+ npm install ${{ github.event.inputs.package_name }}@${{ github.event.inputs.version }}
55
+
56
+ - name: Check if deploy script exists
57
+ id: check-deploy
58
+ run: |
59
+ if grep -q '"deploy"' package.json; then
60
+ echo "has_deploy=true" >> "$GITHUB_OUTPUT"
61
+ echo "✅ Script 'deploy' trouvé"
62
+ else
63
+ echo "has_deploy=false" >> "$GITHUB_OUTPUT"
64
+ echo "⏭️ Pas de script 'deploy'"
65
+ fi
66
+
67
+ - name: Run deploy
68
+ if: steps.check-deploy.outputs.has_deploy == 'true'
69
+ continue-on-error: true
70
+ id: deploy
71
+ env:
72
+ FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
73
+ FIREBASE_SA_KEY: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }}
74
+ run: |
75
+ # Utiliser service account si disponible, sinon token
76
+ if [ -n "$FIREBASE_SA_KEY" ]; then
77
+ echo "🔑 Utilisation du service account Firebase..."
78
+ echo "$FIREBASE_SA_KEY" > $HOME/firebase-sa.json
79
+ export GOOGLE_APPLICATION_CREDENTIALS=$HOME/firebase-sa.json
80
+ fi
81
+
82
+ echo "🚀 Déploiement..."
83
+ npm run deploy
84
+
85
+ - name: Commit and push changes
86
+ run: |
87
+ git add package.json package-lock.json
88
+
89
+ if git diff --staged --quiet; then
90
+ echo "⏭️ Aucun changement à committer"
91
+ else
92
+ git commit -m "chore: update ${{ github.event.inputs.package_name }} to ${{ github.event.inputs.version }} [skip ci]"
93
+ git push
94
+ echo "✅ Changements committes et pushés"
95
+ fi
96
+
97
+ - name: Summary
98
+ if: always()
99
+ run: |
100
+ echo "### 📦 Mise à jour Package" >> $GITHUB_STEP_SUMMARY
101
+ echo "" >> $GITHUB_STEP_SUMMARY
102
+ echo "**Package:** ${{ github.event.inputs.package_name }}" >> $GITHUB_STEP_SUMMARY
103
+ echo "**Ancienne version:** ${{ steps.check-version.outputs.current }}" >> $GITHUB_STEP_SUMMARY
104
+ echo "**Nouvelle version:** ${{ github.event.inputs.version }}" >> $GITHUB_STEP_SUMMARY
105
+
106
+ if [ "${{ steps.check-deploy.outputs.has_deploy }}" = "true" ]; then
107
+ if [ "${{ steps.deploy.outcome }}" = "success" ]; then
108
+ echo "**Déploiement:** ✅ Réussi" >> $GITHUB_STEP_SUMMARY
109
+ else
110
+ echo "**Déploiement:** ❌ Échoué (package mis à jour quand même)" >> $GITHUB_STEP_SUMMARY
111
+ fi
112
+ else
113
+ echo "**Déploiement:** ⏭️ Ignoré" >> $GITHUB_STEP_SUMMARY
114
+ fi