@yoann-86/react_test_lab 0.1.1 → 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,7 +107,7 @@ 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
|
|
@@ -116,7 +116,10 @@ jobs:
|
|
|
116
116
|
publish:
|
|
117
117
|
name: 📦 Publish to npm
|
|
118
118
|
runs-on: ubuntu-latest
|
|
119
|
-
needs:
|
|
119
|
+
needs: [build, test, e2e]
|
|
120
|
+
permissions:
|
|
121
|
+
contents: write
|
|
122
|
+
id-token: write
|
|
120
123
|
steps:
|
|
121
124
|
- name: 👯♂️ Clone repository
|
|
122
125
|
uses: actions/checkout@v4
|
|
@@ -124,17 +127,22 @@ jobs:
|
|
|
124
127
|
uses: ./.github/actions/install-node
|
|
125
128
|
- name: Authenticate with npm
|
|
126
129
|
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
|
|
127
|
-
- name:
|
|
130
|
+
- name: 🔍 Version Check
|
|
131
|
+
id: version-check
|
|
128
132
|
run: |
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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'
|
|
133
146
|
run: |
|
|
134
147
|
pnpm build:npm
|
|
135
148
|
pnpm publish
|
|
136
|
-
git add .
|
|
137
|
-
git commit -m "updated version"
|
|
138
|
-
git push
|
|
139
|
-
env:
|
|
140
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
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.
|