@yoann-86/react_test_lab 0.1.0 → 0.1.2
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.
|
@@ -107,8 +107,42 @@ jobs:
|
|
|
107
107
|
permissions:
|
|
108
108
|
pages: write
|
|
109
109
|
id-token: write
|
|
110
|
-
needs:
|
|
110
|
+
needs: publish
|
|
111
111
|
steps:
|
|
112
112
|
- name: 🚀 Deploy to GitHub Pages
|
|
113
113
|
id: deployment
|
|
114
114
|
uses: actions/deploy-pages@v4
|
|
115
|
+
|
|
116
|
+
publish:
|
|
117
|
+
name: 📦 Publish to npm
|
|
118
|
+
runs-on: ubuntu-latest
|
|
119
|
+
needs: [build, test, e2e]
|
|
120
|
+
permissions:
|
|
121
|
+
contents: write
|
|
122
|
+
id-token: write
|
|
123
|
+
steps:
|
|
124
|
+
- name: 👯♂️ Clone repository
|
|
125
|
+
uses: actions/checkout@v4
|
|
126
|
+
- name: Install Node.js 24.x and pnpm
|
|
127
|
+
uses: ./.github/actions/install-node
|
|
128
|
+
- name: Authenticate with npm
|
|
129
|
+
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
|
130
|
+
- name: 🔍 Version Check
|
|
131
|
+
id: version-check
|
|
132
|
+
run: |
|
|
133
|
+
LOCAL_VERSION=$(cat package.json | jq -r '.version')
|
|
134
|
+
PUBLISHED_VERSION=$(npm view @yoann-86/react_test_lab version 2>/dev/null || echo "0.0.0")
|
|
135
|
+
echo "Local version: $LOCAL_VERSION"
|
|
136
|
+
echo "Published version: $PUBLISHED_VERSION"
|
|
137
|
+
if [[ $(printf '%s\n' "$PUBLISHED_VERSION" "$LOCAL_VERSION" | sort -V | tail -n1) == "$LOCAL_VERSION" ]] && [[ "$LOCAL_VERSION" != "$PUBLISHED_VERSION" ]]; then
|
|
138
|
+
echo "✅ Version is ready to publish"
|
|
139
|
+
echo "should_publish=true" >> $GITHUB_OUTPUT
|
|
140
|
+
else
|
|
141
|
+
echo "⚠️ Local version must be strictly greater than published version - skipping publish"
|
|
142
|
+
echo "should_publish=false" >> $GITHUB_OUTPUT
|
|
143
|
+
fi
|
|
144
|
+
- name: 📦 Publish
|
|
145
|
+
if: steps.version-check.outputs.should_publish == 'true'
|
|
146
|
+
run: |
|
|
147
|
+
pnpm build:npm
|
|
148
|
+
pnpm publish
|
package/README.md
CHANGED
|
@@ -92,6 +92,15 @@ Le projet est automatiquement déployé sur GitHub Pages via GitHub Actions lors
|
|
|
92
92
|
|
|
93
93
|
URL de déploiement : https://yoannauroyynov.github.io/react-test-lab/
|
|
94
94
|
|
|
95
|
+
## Publication npm
|
|
96
|
+
|
|
97
|
+
Le package est automatiquement publié sur npm via la CI/CD lors d'un push sur `main` :
|
|
98
|
+
|
|
99
|
+
- **Vérification** : La publication n'a lieu que si la version dans `package.json` est strictement supérieure à celle publiée sur npm
|
|
100
|
+
- **Tag git** : Un tag de version peut être créé manuellement avant le push
|
|
101
|
+
|
|
102
|
+
Package disponible sur npm : [@yoann-86/react_test_lab](https://www.npmjs.com/package/@yoann-86/react_test_lab)
|
|
103
|
+
|
|
95
104
|
## Configuration CI/CD - Note sur l'optimisation
|
|
96
105
|
|
|
97
106
|
**⚠️ Important :** La configuration CI/CD actuelle (parallélisation des jobs, caching pnpm, etc.) est explorée à titre **éducatif**. Sur un projet de cette taille, ces optimisations ne sont **pas pertinentes** en pratique.
|